Jwqq Jwqq - 3 months ago 8
AngularJS Question

How to setup my url route in my case?

I am trying to capture a route to be something like

www.mysite.com/#name=ted&location=ca


I am using
stateprovider
and I setup as follow:

$stateProvider
.state('home', {
url: '/#name',
controller: function () {
alert('here')
do stuff...
}
})


but for some reason, alert never trigger.

Can someone help me about it? Thanks a lot!

Answer
    var app= angular.module('appName', []);

    app.config(['$routeProvider',
    function($routeProvider) {
    $routeProvider.
    when('/home', {
    templateUrl: 'templates/home.html',
    controller: 'AddOrderController'
     }).
     when('/contact', {
    templateUrl: 'templates/contact.html',
    controller: 'ShowOrdersController'
     }).
    otherwise({
    redirectTo: '/home'
    });
    }]);

Try This Is Example Of Navigation Using With route Providers .