I am a beginner in Angular JS, recently tried $stateProvider refering a tutorials-eggHead. Find code from below:
I am 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 as first",
templateUrl:"template/first.html"
})
});
app.controller( "CtrlOne", function CtrlOne(){
var first = this;
first.message = "Hi";
});
My Output with no error in console
Where did I go wrong. I followed exactly what was shown in the EggHead Tutorial
Why ui-view is not showing up? NO Errors are being showed up for me to refer further.
Please any experts help me. Its really confusing if things are not working fine.
Thanks in advance.