我想使用角度js在网址上传递两个参数, 我在我的app.states.js和视图中声明了这些参数,如下所示,但它不起作用,所以我的架构还有其他解决方案。
提前致谢。
PS:两个参数是:idCol和idForm。
app.states.js
.state("restricted.forms.my_formulaire", {
url: "/my_formulaire/{IdCol:[0-9]{1,4}}/{IdForm:[0-9]{1,4}}",
templateUrl: 'app/views/my_formulaireView.html',
controller: 'my_formulaireCtrl',
resolve: {
deps: ['$ocLazyLoad', function($ocLazyLoad) {
return $ocLazyLoad.load('app/Controllers/my_formulaireController.js');
}]
},
data: {
pageTitle: 'my Formulaire'
}
})
myView.html
<div class="description" ng-show="lstForms.length != 0">
<div class="md-card uk-margin-medium-bottom">
<div class="md-card-content">
<div class="uk-overflow-container">
<table class="uk-table uk-table-hover">
<thead>
<tr>
<th id="formulaire_on">Formulaire</th>
<th id="fo_option">Option</th>
</tr>
</thead>
<tbody>
<tr class="formulaire_option" ng-repeat="(k,l) in lstForms">
<td>{{l.f_name}}</td>
<td>
<a ui-sref="restricted.forms.my_formulaire({IdCol:l.f_fk_collecte_id})({IdForm:l.f_id})"><i class="md-icon material-icons"></i></a>
<a ng-click="DeleteForm(k,l)"><i class="md-icon material-icons">delete_sweep</i></a>
<a ng-click="copyForm(l)"><i class="md-icon material-icons">content_copy</i></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
答案 0 :(得分:2)
您可以将2个变量传递给ui-sref
,如下所示:
<a ui-sref="restricted.forms.my_formulaire({ IdCol: l.f_fk_collecte_id, IdForm: l.f_id })">
<i class="md-icon material-icons"></i>
</a>