I have the following div:
<div ng-repeat="state in Home.overlaySettings.data.games[0].events[0].states">
<div class="col-xs-12 col-md-4 noPadding" ng-repeat="feature in state.features" ng-show="state.name == Home.overlaySettings.data.games[0].events[0].state">
<div class="form-group">
<button
type="button"
class="btn largeButton"
ng-class="{'btn-success':feature.enabled == true,'btn-danger':feature.enabled == false}"
ng-click="feature.child('enabled').set(!feature.enabled);">
{{feature.name}}
</button>
</div>
</div>
</div>
The above code works with firebase. All I want to do is set the value from true to false when you click the button and then back again to true if you click it again.
My problem is that I can't figure out how to save the value. The feature is among many features and therefore I can't just search for it from the root element.
To show what Home.OverlaySettings is, have a look at this function:
function OverlaySettings(fbURL, $firebase, $q) {
var fb = {"data":null,"ref":null,"ready":$q.defer()};
initFB();
function initFB() {
fb.ref = new Firebase(fbURL);
fb.data = $firebase(fb.ref).$asObject();
fb.data.$loaded(
function(data) {
fb.ready.resolve()
}
);
}
return function() {
return fb;
}
}
How can I save the value?