This is a migrated thread and some comments may be shown as answers.

Grid with Angular - ng-click not working

2 Answers 862 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Saquib
Top achievements
Rank 1
Iron
Iron
Iron
Saquib asked on 19 Aug 2015, 10:25 AM

Hi,

 Hopefully someone can tell me what I'm doing wrong here!

Example to re-produce here;

 http://plnkr.co/edit/3jLcnD16BdLQNJatBxCu?p=preview

 

Simple grid with one column built from a template. The template builds a button which includes ng-click as an attribute.

(in index.html) 

 <script id="link-template" type="text/kendo-templ">
    
    # if (fieldT > 0) { #
    <button type="button" ng-click="actionLink('#=fieldT#')">
                            Field T Link
    </button>
         # }
     else { # No Link
         # } #
    
    </script>

 

The button is build correctly, and includes the ng-click attribute.

 

However, the on clicking the button, the function is not called (either within the $scope or global functions).

 I've included kendo.directives as a dependency when loading angular.

What do I need to do to fix ?

 

Many thanks!

2 Answers, 1 is accepted

Sort by
0
Saquib
Top achievements
Rank 1
Iron
Iron
Iron
answered on 19 Aug 2015, 10:39 AM

P.S. Also finding that Kendo UI Angular events are not firing (although I've included kendo.directives)

     $scope.$on("kendoWidgetCreated", function(event, widget){

            console.log(widget);
      });   

The kendoWidgetCreated event never fires.

0
Accepted
Boyan Dimitrov
Telerik team
answered on 21 Aug 2015, 08:36 AM

Hello Saquib,

 

I found the problem in the provided code. 

 

The Kendo UI Grid was initialized using the jQuery Plugin syntax. Please refer to the Using Kendo with AngularJS article in order to find more information about AngularJS Kendo UI widget initialization. 

 

Also I modified the http://plnkr.co/edit/OpVOrGTl8qrEgUrcdjf3?p=preview example and now it works fine. 

 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Saquib
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Saquib
Top achievements
Rank 1
Iron
Iron
Iron
Boyan Dimitrov
Telerik team
Share this question
or