A/Angularjs
Setting scope property with ng-init doesn't work
안뇽헬로
2014. 6. 7. 12:35
<body ng-controller="MainCtrl" ng-init="init()">
<div ng-init="init('Blah')">{{ testInput }}</div>
</body>
app.controller('MainCtrl', ['$scope', function ($scope) {
$scope.testInput = null;
$scope.init = function(value) {
$scope.testInput= value;
}
}]);
Here's an example.
ng-init가 잘 작동되지 않으면 이렇게 해보는 게 좋을 듯하다.
아님 이렇게 초기화 값을 init에 집어넣는 것도 괜찮은 듯
http://stackoverflow.com/questions/19981627/setting-scope-property-with-ng-init-doesnt-work