Bresleveloper's AngularJS Tutorial : Basic+ Route / Routing

http://bresleveloper.blogspot.co.il/2013/08/breslevelopers-angularjs-tutorial-table.html

there is a nice thing with the $routeProvider that I learned from maybe the best and most advanced blogger in the world about angular - Ben Nadel, here in this post : http://www.bennadel.com/blog/2420-Mapping-AngularJS-Routes-Onto-URL-Parameters-And-Client-Side-Events.htm
u can put anything u want in ur routes!

Ex no. 11

view (customRouteView, only for that top div) - I added this div at the top:
<div>{{ Bresleveloper }}</div>

code (Ex 11) - there r only 2 changes, 1st I added a view with the extra div
templateUrl: 'Views/customRouteView.html'

2nd change is in the CTRL:
       
var myController = function ($scope, myService, $route) {
    console.log("myController - NEW INSTANCE");
    $scope.myService = myService;
    myService.getData();

   
if ($route.current.Bresleveloper) {
        $scope.Bresleveloper = $route.current.Bresleveloper;
    }
   
else {
        $scope.Bresleveloper = ":)";
    }
};
 
 
 


another example, to help understand Bens example is my Ex 19

now if u think its of no use, then Ben took it to the next level here : http://www.bennadel.com/blog/2441-Nested-Views-Routing-And-Deep-Linking-With-AngularJS.htm
I do advice you to make a couple of angular apps before trying that cuz its a bit hard to grasp, u use routing but not for routing, look at my examples Ex 19.

Next : http://bresleveloper.blogspot.co.il/2013/08/breslevelopers-angularjs-tutorial_22.html

Comments

Popular posts from this blog

c# Service Play Sound with NAudio example by Moshe

Asp.Net Ending Response options, Response.End() vs CompleteRequest()

JS/JQ simulate Enter event