Issue
My angularjs controller function is never called. I see all the js files included in my sources, it's just not ever hitting the initialization of my controller. What is wrong with this code?
eventListCtrl.js:
eventsApp.controller('eventListCtrl', ['$scope', function ($scope) {
// this code is 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>
Solution
You need to do this
<html ng-app="eventsApp">
So you actually activate the module
Answered By - iConnor
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.