javascript - AngularJS controller function never called -
my angularjs controller function never called. see js files included in sources, it's not ever hitting initialization of controller. wrong code?
eventlistctrl.js:
eventsapp.controller('eventlistctrl', ['$scope', function ($scope) { // code never called alert('controller initializing'); $scope.name = "test"; }]);
app.js:
'use strict'; var eventsapp = angular.module('eventsapp', []);
index.cshtml:
<div ng-controller="eventlistctrl"> <div class="row"> <div class="spann11"> <h2>{{name}}</h2> </div> </div> </div> <script src="/scripts/vendor/angular.js"></script> <script src="/scripts/app.js"></script> <script src="/scripts/controllers/eventlistctrl.js"></script>
you need
<html ng-app="eventsapp">
so activate module
Comments
Post a Comment