Is it possible to save a call to an anonymous function using ng-init? For example:
<div class="container-fluid" ng-app="AVF" ng-controller="ConfigController" ng-init="RegisterInitFunction(function() { $scope.GetData(); })" >
In my controller:
$scope.InitFunction = null;
$scope.RegisterInitFunction = function(init) {
$scope.InitFunction=new Function(init)();
}
$scope.GetData = function() {
$scope.DoSomething();
}
When trying this, I encounter a syntax error angular.min.js:107 Error: [$parse:syntax]
Can someone help me figure out if this is feasible?