angularjs-ng-clickui-gridcelltemplate

ng-click in Angularjs ui-grid cell Template doesn't work


I don't know why with the following template ng-click doesn't work:

<div>
<md-icon ng-click="console.log('hello'); $event.stopPropagation();" md-font-icon layout-fill ng-
         class="md-raised inline-icon fa statusCellIcon" style="z-index:1000;">
</md-icon>

$event.stopPropagation() executes but not the console.log.

someone knows why?

Thank you.


Solution

  • The solution if someone is interested by was:

    Expose the method to the ui-grid by adding the following to the grid options:

    appScopeProvider: someFunction: function () { doSomeThing(); }
    

    And in the ColumnTemplate of the grid add the following code:

    <div>
    <md-icon md-font-icon layout-fill class="inline-icon fa"
             ng-click="grid.appScope.someFunction(); $event.stopPropagation();"
             ng-style="{'cursor':'pointer'}">
    </md-icon> ...</div>