I’ve been watching angularjs and backbone in the past few days, and I’ve learned a lot about knockout and emberjs. I just saw a demo of angular’s router online, and I’m writing it down now
route
Route Demo index
http://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.2pre/html5shiv.js">>
http://cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js">>
http://localhost:81/js/angular.min.js">>
<script><br>
var routeApp = angular.module('routeApp',[]);<br>
routeApp.config(['$routeProvider',function ($routeProvider) {<br>
$routeProvider<br>
.when('/list', {<br>
TemplateUrl: 'list.html',<br>
controller: 'RouteListCtl'<br>
})<br>
.when('/list/:id', {<br>
TemplateUrl: 'detail.html',<br>
controller: 'RouteDetailCtl'<br>
})<br>
.otherwise({<br>
redirectTo: '/list'<br>
});<br>
}]);<br>
//controller<br>
routeApp.controller('RouteListCtl',function($scope) {<br>
});<br>
routeApp.controller('RouteDetailCtl',function($scope, $routeParams) {<br>
$scope.id = $routeParams.id;<br>
});<br>
</script>
That’s it for the code, I hope you guys like it.