1

I have a cellTemplate that's supposed to make a row editable when clicked. Works so far. However when this is done, also a function should be called, which just isn't happening:

colDef:

cellEditableCondition: ($scope) => $scope.row.editable

what I tried in cellTemplate:

ng-click="row.editable = true;" //works
ng-click="row.editable = true; console.log('WTF?')" //works, no log
ng-click="console.log('WTF?'); row.editable = true;" //works, no log
ng-click="console.log('WTF?')" //no log either

When you click the button, the cells become editable, just as intended. But nothing's printed to the console . And I can't seem to figure out why. Is there something I'm missing? How do I call a function from within a cellTemplate?

j2L4e
  • 6,914
  • 34
  • 40

1 Answers1

2

console belongs to the javascript window object. It is not inside angular's scope. If you want to use it in an angular template, in your controller add this:

$scope.console = window.console;
Tarun Dugar
  • 8,921
  • 8
  • 42
  • 79
  • I was aware of this and usually set `$rootScope.console = console;` in app.run(). However I now learned that ui-grid uses isolated scopes that do not inherit. Thanks for leading me on the right track! – j2L4e Nov 04 '15 at 12:03
  • Sorry, the Return key sending the comment right away will drive me nuts some day. I edited my last comment. Thanks again, Tarun! – j2L4e Nov 04 '15 at 12:07