
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
4 Answers, 1 is accepted

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
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

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
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