简体   繁体   中英

Anchor tag not working with Angular UI-Router

I am new to AngularJS. I want to pass a parameter through anchor tags in the following $stateProvider code of AngularJS, but it is not working. What is the proper way to send a parameter via anchor link in ui-sref

<a ui-sref="Type/valid">Valid Email</a>
<a ui-sref="Type/invalid">Invalid Email</a>

app.config(function($stateProvider, $urlRouterProvider){
    $urlRouterProvider.otherwise('Type/valid');
    $stateProvider.state("Type", {
        url:"/Type/:type",
        templateUrl: "valid.php"    
    });
});

With ui-sref you can specify arguments like that

<a ui-sref="Type({ type: 'valid' })">Valid Email</a>
<a ui-sref="Type({ type: 'invalid' })">Invalid Email</a>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM