【发布时间】:2016-10-27 06:55:06
【问题描述】:
您好,我对 angularjs 很陌生,这是我的代码
html
<table ng-table="tctrl.tableEdit" class="table table-striped table-vmiddle" show-filter="true">
<tr ng-repeat="w in $data" ng-class="{ 'active': w.$edit }">
<td data-title="'Company name'" filter="{ 'cl_company_name': 'text' }" sortable="'cl_company_name'">
<a ui-sref="clients.client-detail({ clientId: w.cl_id })"><span ng-if="!w.$edit">{{ w.cl_company_name }}</span></a>
<div ng-if="w.$edit"><input class="form-control" type="text" ng-model="w.cl_company_name" /></div>
</td>
</tr>
</table>
controller.js
.controller('TabsClientCtrl', function ($scope, $window, $stateParams) {
$scope.clID = $stateParams.clientId
alert($scope.clID)
})
state.js
.state ('clients', {
url: '/clients',
templateUrl: 'views/common.html'
})
.state('clients.client-detail', {
url: '/client-detail',
templateUrl: 'views/client-detail.html',
resolve: {
...
}
})
当我点击 td 中的公司名称时,我收到未定义的警报。这是使用 ui-sref 传递参数的正确方法吗?
【问题讨论】:
-
您在
w中有什么,并将您的状态配置添加到问题中。 -
是的,你有问题,请检查我的回答
标签: javascript jquery angularjs angular-ui-bootstrap