This is what I'd like to do in an Angular factory:
app.factory('dataService', function () {
return {
data: ['5', '10', '20', '50', '100', '200'],
selectedData: data[0],
},
},
)
Basically, I want to initialize selectedData to one of the items of predefiend data array. This code returns data is not defined. If I use this.data[0], I get the error: Cannot read property '0' of undefined. So, how do I refer to data here?