javascript - Why controller is not getting bound to angular app variable -
why ngcontroller schedulecontroller not getting bound page. same working in this video (@29th minute)
<!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" ng-app=""> <head> <title></title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" /> </head> <body ng-controller="schedulecontroller"> <div class="container"> <select ng-model="test" ng-options="schedule schedule in scheduler.scheduletype"> </select> {{value}} </div> <script src="scripts/angular.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script> function schedulecontroller($scope) { $scope.scheduler = { scheduletype: ['one time', 'daily', 'weekly', 'monthly' , 'monthly relative', 'yearly', 'year long'] }; $scope.value = 'shantanu'; } </script> </body> </html> i using angularjs v1.4.1
if you're using angular version 1.3 or up, have manually register controller app. means can't have ng-app="", need have, instance, ng-app="myapp", , have:
var myapp = angular.module("myapp", []); myapp.controller("schedulecontroller", schedulecontroller);
Comments
Post a Comment