如何$scope从ui-grid单元模板访问?这是我的控制器代码:
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>'
}]
};
}]);
Run Code Online (Sandbox Code Playgroud)
请在此处查看:http: //plnkr.co/edit/WYXeQShHWKDYDs4MIZnP?p = preview
我希望细胞内容显示"你好世界",但他们只是显示"你好".