글
Setting scope property with ng-init doesn't work
A/Angularjs
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
'A > Angularjs' 카테고리의 다른 글
Getting $rootScope:inprog error when calling click method of input type file programmatically (0) | 2015.05.04 |
---|---|
responsive를 위한 AngularJS (0) | 2014.10.21 |
accessing-parent-window-angular-scope-from-child-window (0) | 2014.06.01 |