ng-单击下面的HTML working me AngularJS
<tr ng-repeat="ai in alert_instances" ng-click="go('/alert_instance/{{ai.alert_instancne_id}}')">
<td>{{ai.name}}</td>
<td>{{ai.desc}}</td>
</tr>目前我的控制器中的"go“函数只有
$scope.go = function (hash) {
console.log("hi")
};发布于 2013-03-08 14:45:57
你做错了。您不应该在Angular指令(ng-click)中使用大括号,因为这种语法是针对模板的。
一种正确的方式:
<tr ng-repeat="ai in alert_instances" ng-click="go(ai)">
<td>{{ai.name}}</td>
<td>{{ai.desc}}</td>
</tr>
$scope.go = function(ai) {
var hash = '/alert_instance/' + ai.alert_instancne_id;
//...
};https://stackoverflow.com/questions/15288047
复制相似问题