Currently, if you are using angularjs router, and use ui-self to link your destination page in html, and you can pass on the parmaters by ui-self. However, if right click and 'open link in new tab', the parameters in ui-self will be missing, and it can't pass on. what we can do?
first let's browse a code:
1. file 1: audience.js
$stateProvider.state('audiencesCreate', {
url: '/audience/create-audience',
params: {folder: null, type: null},
templateUrl: 'templates/audiences/audiences.create.html'
});
file 2: checkout.html
<div class="col-md-12">
<ul>
<li ng-if="audiencePermission.digital">
<a ui-sref="audiencesCreate({type:'digital'})">Start a New Digital Audience</a>
</li>
<li ng-if="audiencePermission.tv">
<a ui-sref="audiencesCreate({type:'tv'})">Start a New TV Audience</a>
</li>
<li ng-if="audiencePermission.firstParty">
<a ui-sref="audiencesUpload">Start a New Upload (Audience Onboard)</a>
</li>
<li>
<a ng-click="open(audienceID)">View this Distribution</a>
</li>
<li>
<a href ui-sref="audiencesSaved">Browse Saved Audiences</a>
</li>
</ul>
</div>
Question: It can't open link in new tab.
Solution: change js code for url with add '?parameter'
The only difference is now we have the parmeter in url when open digital or tv.
$stateProvider.state('audiencesCreate', {
url: '/audience/create-audience?type?folder',
params: {folder: null, type: null},
templateUrl: 'templates/audiences/audiences.create.html'
});
评论 (0)