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/
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With