Angular JS <a href=""> route back to LogIn

时间:2016-12-14 07:10:44

标签: javascript angularjs angular-ui-router mean-stack ngroute

I've placed a below link in my code

<a href="/#/list/' + data._id + '" class="btn btnprimary1" > LIST </a>

It should routed to below point

 .state('index.list', {
            url: '/list/:id',
            templateUrl: '/list.html',
            data: { pageTitle: 'listing', pageFilter: 'off' },
            controller: 'listController',
            });

Instead of that it routed to the main page /# and from that it checks login and rerouted to my current page

Is it a correct way to place href in angular code to route to a state with specific Id.

3 个答案:

答案 0 :(得分:2)

您应该使用ngHref

<a ng-href="/#/list/{{data._id}}"></a>

或者更喜欢ui-sref

<a ui-sref="index.list({id: data._id})"></a>

答案 1 :(得分:1)

你应该使用休闲方法

dependencies {
   compile group: 'org.nd4j', name: 'nd4j-context', version: '0.7.1'
   compile('org.deeplearning4j:deeplearning4j-nn:0.7.1')
}

答案 2 :(得分:1)

您应该使用ng-href指令代替Angular中的href标记。

<a ng-href="http://127.0.0.1/projectFolder/#/list/{{data._id}}" class="btn btnprimary1"> LIST </a>