Mohan Gopi
Mohan Gopi

Reputation: 7724

ui-router on clicking a button $state.go new page

http://plnkr.co/edit/D89QGLbKWbqp6T7Igfhy

the above plnkr have my same project of what i have done to navigate to another page on clicking a button(login) i should go to view.html page i am not sure where i am strugling please let me know if you find my error

.config(function($stateProvider, $urlRouterProvider) {
        $stateProvider
            .state('login', {
                url: '/login',
                templateUrl: 'templates/view.html',

            });
        $urlRouterProvider.otherwise('view.html');
 });

this what my .config file look like

Upvotes: 0

Views: 2359

Answers (3)

ddepablo
ddepablo

Reputation: 677

In this plnkr you can see ng-click directive in the button that call a function in Login controller. This function calls $state.go("login") that will redirect to view.html.

Upvotes: 1

RamaKrishna
RamaKrishna

Reputation: 217

Try This

        .state('login', {
            url: '/login',
            title: 'UnPublished',
            templateUrl: helper.basepath('templates/view.html'),
            resolve: helper.resolveFor('ui-router')
        })

Upvotes: 0

Charles
Charles

Reputation: 180

You need to map your button with the wanted state:

<a ui-sref="login">
   <button class="button button-block button-positive">
        login
   </button>
</a>

http://plnkr.co/edit/J9MmnPac2GXgqL522oHe

Upvotes: 0

Related Questions