Hi I'm new to angular. I am stack with ui router for couple days now. sref 
link is not working to view the other html file. Heres the code below.

index.html

<!DOCTYPE html>
<html ng-app="myapp">

<head>
<title>AngularJS: UI-Router Quick Start</title>
<!-- Bootstrap CSS -->
<link href=
"https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.3.1/css/bootstrap.min.css";
 
rel="stylesheet">
</head>

<body class="container">
<p><i>Best viewed in pop-out mode to see location changes. Click blue 
button on the right.</i></p>

<div class="navbar">
<div class="navbar-inner">
<a class="brand" href="#">Quick Start</a>
<ul class="nav">
<li><a ui-sref="route1">Route 1</a></li>
<li><a ui-sref="route2">Route 2</a></li>
</ul>
</div>
</div>

<div class="row">
<div class="span12">
<div class="well" ui-view></div> 
</div>
</div> 
<!-- Angular -->
<script src=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.2.4/angular.js";></script>
<!-- UI-Router -->
<script src=
"https://cdnjs.cloudflare.com/ajax/libs/angular-ui-router/1.0.22/angular-ui-router.js";
></script>
<!-- App Script -->
<script src="script.js"></script>
<script src="route1.js"></script>
<script src="route2.js"></script>

</body>

</html>



script.js

(function(){
var myapp = angular.module('myapp', ["ui.router"]);
myapp.config(function($stateProvider, $urlRouterProvider){
// For any unmatched url, send to /route1
$urlRouterProvider.otherwise("/route1")
$stateProvider
.state('route1', {
url: "/route1",
templateUrl: "route1.html"
})
.state('route1.list', {
url: "/list",
templateUrl: "route1.list.html",
controller: "route1ctrl"
})
.state('route2', {
url: "/route2",
templateUrl: "route2.html"
})
.state('route2.list', {
url: "/list",
templateUrl: "route2.list.html",
controller: "route2ctrl"
})
});
})();



route1.html

<h1>Route 1</h1>
<hr/>
<a ui-sref=".list">Show List</a>
<div ui-view><h1>Hello</h1></div>


aaa

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to