Hi guys, 
I want to share my source with you i have some problem on routing, am new 
for angular js

'use strict';

var sampleApp =    angular.module("myapp", [])
                    
sampleApp.controller("MyController", function($scope, $location, $window) {
                        $scope.doClick = function() {
                       //By using this location path i just embed the path 
in url it was reflecting there, but it was not routing to the page that i 
have mentioned below.
                      $location.path('/home');
                           }
            });    
            
sampleApp.config(['$routeProvider','$locationProvider', 
function($routeProvider,$locationProvider) {
    $routeProvider.when('/home', {
        templateUrl: 'pane.html',
        controller : 'MnController'});
    $routeProvider
    .otherwise({redirectTo: '/home'});
    }]);

Please suggest me to recover from these bug

On Wednesday, May 23, 2012 10:11:00 AM UTC+5:30, Freewind wrote:
>
> For example, there is a button "Create" in my page, and it has ng-click 
> attribute:
>
>     <button ng-click="create()">Create</button>
>
> And in the `create()` function, I want to do something, then redirect to 
> another route `#/show`, which is a client site route defined in angularjs:
>
>     function MyCtrl($scope) {
>         $scope.create = function() {
>              // do something
>              // how to redirect to `#/show`, another view and controller 
> will be used
>         }
>     }
>
>
>

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

Reply via email to