How to set scope property with ng-init?

前端 未结 6 459
借酒劲吻你
借酒劲吻你 2020-11-30 02:26

I am trying to set the value of a $scope property using ng-init, and I am unable to access that value in the controller\'s javascript. What am I doing wrong? Here is a fidd

6条回答
  •  醉酒成梦
    2020-11-30 02:55

    Try this Code

    var app = angular.module('myapp', []);
      app.controller('testController', function ($scope, $http) {
           $scope.init = function(){           
           alert($scope.testInput);
       };});
    

    
          

提交回复
热议问题