angularjs - Access a directives scope variable from another directive -


i have directive function , access function @ click of button. want access $scope variable function directive , use in directive's view

here code directive has function defined in it:

$scope.footerlinkclicked = function (item2) {     $scope.myvalue = true;       console.log("parameter received :" );      $scope.item1 = item2;     console.log($scope.item1);      $rootscope.$broadcast('item1',$scope.item1); } 

in other directive's view want like

<div class="panel panel-primary" ng-show="myvalue"> 

now, want acces myvalue variable in directive. way ?

thanks in advance!

its better 2 use object instead of primitive variable.

<one-d  my-value="objval"></one-d>   <two-d  my-value="objval"></two-d> 

in directive script should use this

    return {     scope: { myvalue: '=' },     link: function(scope, ele, attr) {          scope.footerlinkclicked = function(item2) {             scope.myvalue.data = true;             scope.item1 = item2;          }        }   } 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -