Reputation: 293
I'm trying to get angular working in my dotnet webapi project. I've installed angular and angular-ui-router through npm and all scripts added to my default.html page with development and stage/production.
To test it, i've written the following:
<body ng-app="myApp">
<h1>hello</h1>
{{2+2}}
</body>
This code doesn't work and gives me the error: Error: $injector:modulerr Module Error. It can't get myApp. I've included the app.js in default.html where myApp is.
angular.module('myApp', [
I have tried with ui-view and added a .state, but that doesn't work either. the {{2+2}} works though, if i only type ng-app in tag. What am i doing wrong?
Thanks in advance.
EDIT: https://jsfiddle.net/ztn4kc15/
Upvotes: 3
Views: 189
Reputation: 12672
your dependency is wrong. You should use
angular.module('myApp', ['ngRoute']);
See Fiddle
ui.route
stands for AngularUI router, but angular-route
(the one you added in the fiddle) stands for ngRoute
Upvotes: 3