Add "ng-click" to item

5 posts, 0 answers
  1. Werner Haltner
    Werner Haltner avatar
    20 posts
    Member since:
    Jun 2006

    Posted 04 Aug 2015 Link to this post

    Hello

    I have a DataSource with Items and i want to add a "ng-click" to each data item, which should trigger the corresponding $scope function.

    How can i add a "ng-click" to the items?

     

    Thanks,
    Werner

     

  2. Werner Haltner
    Werner Haltner avatar
    20 posts
    Member since:
    Jun 2006

    Posted 05 Aug 2015 in reply to Werner Haltner Link to this post

    Meanwhile i fix the problem using/bind the "select" Event and call then the needed function.

    If there is another solution, i would like to know it.

    Thanks,
    Werner

     

  3. Kendo UI is VS 2017 Ready
  4. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 06 Aug 2015 Link to this post

    Hi Werner,

    The ng-click event handler should be attached to specific HTML elements - attaching it directly to DataSource items is not supported. Would you please share more details about your scenario? That will help us suggest a better solution.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Werner Haltner
    Werner Haltner avatar
    20 posts
    Member since:
    Jun 2006

    Posted 06 Aug 2015 Link to this post

    Hello Alexander

    Before i use the DataSource i have set a link with "ng-repeat" and each link has a "ng-click" attribute.
    Something like this:

    <a ui-sref="demo.demoItem({demoPath: nav.Path.Path, demoSystemId:nav.Path.FolderSystemId})" ng-click="events.doSomething(nav.Path.Path)"></a>

     

    Then i start using the DataSource and set the link via the URL property. Like this:

    {
    ...
    url : "#/demo/demo/" + demoPath + "/" + demo.Path.demoSystemId + "";
    ...
    }

    i use then in the panelbar widget the "select" Event and handle the same logic which i had before in the "events.doSomething()" method from "ng-click"

     

    So, the question is,
    a) is it possible, to set some additional properties, functions in the data item from a dataSource?
    b) and how to access this property/function ?

     

    Thanks,
    Werner

     

     

     

     

     

  6. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 10 Aug 2015 Link to this post

    Hello Werner,

    The PanelBar has no means of correlating its items to the corresponding DataSource records (e.g dataItem method). You could however, try using the index of the selected panel in the event handler, as shown here. If that is not the behavior you are after I would ask you to modify the Dojo accordingly and share more details about what the expected behavior is.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready