如何从ui-grid单元格模板中访问$scope
?这是我的控制器代码:
app.controller('MainCtrl', ['$scope', function ($scope) {
// i want to reference this from a cell template.
$scope.world = function() { return 'world'; };
$scope.gridOptions = {
data: [
{ id: "item1" },
{ id: "item2" }
],
columnDefs: [
{
field: 'id',
// world() is never called and is not displayed.
cellTemplate: '<div>{{ "hello " + world() }}</div>'
}]
};
}]);
在这里查看它的实际效果:http://plnkr.co/edit/WYXeQShHWKDYDs4MIZnP?p=preview
我期望单元格内容显示为“hello world”,但它们只显示“hello”。
ng-change="grid.appScope.checkValidaton($event,MODEL_COL_FIELD,true,true)
。虽然作用域函数被调用,但是参数是未定义的。我该如何传递$event
和ng-model
? - Saurabh Tiwari