【发布时间】:2015-07-01 23:55:43
【问题描述】:
我的代码是:
<div ng-controller="myCtrl">
<div class="row">
<div class="col-md-4 col-sm-3">
<checked-input ng-scope="$eventID"></checked-input>
</div>
<div class="col-md-4 col-sm-3">
<output ng-scope="$postbackOutput">***This is where I want the text typed in the textbox to go***</output>
</div>
<div class="col-md-3 col-sm-3">
<a ng-click="generateURL($eventID)" class="btn-plus">
<span class="glyphicon glyphicon-plus"></span>
</a>
</div>
</div>
</div>
所以我要做的是获取位于第一列 div 内的 $eventID,然后在单击 <a> 标记中的链接时将其作为参数传递给函数调用 generateURL()第三列。在控制器内部我有:
app.controller('postbackCtrl', function($scope) {
$scope.generateURL = function(eventID) {
$scope.postbackOutput = eventID;
}
});
但它似乎没有正确设置<output> 中的文本。有人可以帮忙吗?我刚开始使用角度,所以有点混乱。
【问题讨论】:
标签: javascript html angularjs angularjs-scope