Routing

Crazy Bugs

  • Navigating user as per its request
  • As we know in MVC, when request comes to controller it redirect user as per URL parameters. Same concept is used in Angular as Routing

Ex. There may be a home.html page which is default page. So every user visits it as first page. Then if URL parameter as like http://…/order where user is redirect to order page etc. If it is http://…/payment then redirected to payment gateway

How to get Routing done?

  • To work with routing in Angular, we have include .js file
  • Go to https://code.angularjs.org/1.2.15/ ( Here 1.2.15 is the version I am using. It might be different )
  • Copy code of angular-route.js file in user workspace in separated .js file
  • Use ngRoute as dependency in custom module creation as

var app = angular.module(‘customerModule’, [‘ngRoute’]);

Steps for Routing

Create Controllers files

  • Create plain JavaScript function having data holder variables.
  • Inject $scope object

View original post 147 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s