Just trying to figure out why in this case I would need to use $ scope. $ apply? According to all the information I read about the subject, I don’t need to, since everything happens inside Angular? What am I missing?
In my controller:
$scope.savePreset = function(columns, $event){
$event.preventDefault();
preset.name = prompt("Please enter preset name", "My Preset");
if (preset.name != null) {
preset.columns = $scope.columns;
$scope.presets[preset.name] = preset;
alert('Your preset "' + preset.name + '" has been saved.');
$scope.loadPreset(preset.name);
} else {
alert('Please enter a valid name.');
}
}
(the function savePresetis called in the ng-click directive and there is ng-repeat for preset in presets, which is not updated).
Thanks Pim
source
share