john
john

Reputation: 13

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"    
    });
});

Upvotes: 1

Views: 304

Answers (1)

DAXaholic
DAXaholic

Reputation: 35408

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>

Upvotes: 1

Related Questions