title: AngularJS : Directive not able to access isolate scope objects
body: <p>I am trying to put some default values in my directive with Isolate scope. Basically, I need to do some DOM manipulations using the scope object when my directive is bound. Below is my code:  </p>
  
  <p>Controller:  </p>
  
  <pre><code>angular.module('ctrl').controller('TempCtrl', function($scope, $location, $window, $timeout, RestService, CommonSerivce) {
  
  $scope.showAppEditWindow = function() {
      //Binding the directive isolate scope objects with parent scope objects
      $scope.asAppObj = $scope.appObj;
      $scope.asAppSubs = $scope.appSubscriptions;
  
      //Making Initial Settings
      CommonSerivce.broadcastFunction('doDirectiveBroadcast', "");
  };
  </code></pre>
  
  <p>Service:  </p>
  
  <pre><code>angular.module('Services').factory('CommonSerivce', function ($rootScope) {
  return {       
      broadcastFunction: function(listener, args) {
          $rootScope.$broadcast(listener, args);
      }
  };
  </code></pre>
  
  <p>Directive:</p>
  
  <pre><code>angular.module('directives').directive('tempDirective', function() {
  return {
      restrict : 'E',
      scope:{
          appObj:'=asAppObj',
          appSubs: '=asAppSubs'
      },
      link : function(scope, element, attrs) {},
      controller : function ($scope,Services,CommonSerivce) {         
          //Broadcast Listener 
          $scope.$on('doDirectiveBroadcast', function (event, args) {
              $scope.setDefaults();
          });
  
          $scope.setDefaults = function() {
              //Setting Default Value
              alert(JSON.stringify($scope.appSubs)); //Coming as undefined            
          };
      },
      templateUrl:"../template.html"
      };
  });
  </code></pre>
  
  <p>Custom Directive element:</p>
  
  <pre><code>&lt;temp-directive as-app-obj="asAppObj" as-app-subs="asAppSubs" /&gt;
  </code></pre>
  
  <p>Now, the issue is that while trying to access the isolate scope in the default method inside directive, I aam getting an undefined value whereas the data is coming and is getting bound to the DOM. How can I access the isolate scope in the broadcast listener and modify the directive template HTML? Is there another wasy for handling this?</p>