javascript - $stateProvider not working and not displaying error in console -
i beginner in angular js, tried $stateprovider refering tutorials-egghead. find code below:
i not getting correct response.
index.html
<!doctype html> <html ng-app="myapp"> <head> <title>home page</title> </head> <body> <h1>hello world</h1> <ui-view></ui-view> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/0.2.18/angular-ui-router.js"></script> <script src="js/app.js"></script> </body> </html> first.html
<div> <h1>hello</h1> <input type="text" ng-model="first.message" /> <h1>{{ first.message }} {{ "naresh" }}</h1> </div> app.js
var app = angular.module( "myapp", ["ui.router"] ); app.config( function config($stateprovider){ $stateprovider.state("index", { url:"", controller:"ctrlone first", templateurl:"template/first.html" }) }); app.controller( "ctrlone", function ctrlone(){ var first = this; first.message = "hi"; }); my output no error in console
where did go wrong. followed shown in egghead tutorial
why ui-view not showing up? no errors being showed me refer further.
please experts me. confusing if things not working fine.
thanks in advance.
the code looks fine, i'd cors issue.
you loading looks file:///c:/users... url.
that means won't load other files - should seeing error this:
xmlhttprequest cannot load file:///c:/users/.... cross origin requests supported protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
this see when loading code:
i suggest take here figure out issue.
if local server , running code work.



Comments
Post a Comment