Sometimes there is a situation in which one want to access data from Controller to Directive. So let's see how we can pass data from controller to directive in AngularJs
In below example, controller data is passed to the directive using data variable in directive tag i.e "data = widget.data".
<div kanban-component data="widget.data"></div>
Step 3 -
Sample Directive:
In Below example “=” character with the object passed into the component property is a two-way binding approach which is used to pass data to the directive, as a result you can get data in $scope.component.
0 Comment(s)