angularjs - Error: Argument 'Ctrl' is not a function, got undefined -
var myapp = angular.module('myapp', []); myapp .config(['$routeprovider',function($routeprovider) { $routeprovider. when('/login', { templateurl: 'static/lib/templates/login.html', controller: 'ctrl' }). otherwise({ redirectto: '/addorder' }); }]);
my html:
<body ng-controller="ctrl" > ..... </body>
i getting error saying controller not defined.
is ctr defined in js file? typically like...
var app = angular.module('myapp', ['ngresource', 'ngroute']); app.controller('ctrl', function ($scope, $http) { console.log("a login ctrl...."); });
make sure including ctrl script in html:
<script src="login.controler.js"></script>
Comments
Post a Comment