title: angularjs - directive - two way binding, getting keys from collection in the directive
body: <p>I am trying to build a picker dialog as a directive, the input is a collection of json data. I am then trying in the template to use a table in which the collection keys are in the thead. The thing is, the collection data is displaying ok (currently displaying in the template just 'name' property), the i cant get the keys, because $scope.collection returns undefined. Using Lo-Dash to get the keys.</p>
  
  <p>I have a directive:</p>
  
  <pre><code>.directive('pb5pickerDialog', function(){
      return {
          restrict: 'EA',
          scope:{
              collection : '=',
              onsubmit : '&amp;'
          },
          templateUrl: "/pb5/c/js/views/pb5pickerDialog.html",
          link : function(scope, element, attrs) {
            scope.onclose = function(){
               $("#pb5pickerDialog").modal('toggle');
            };
            console.log(scope.collection); //this undefined
          },
          controller: function($scope, $element){
             console.log($scope.collection); //this undefined
             console.log(_.keys($scope.collection));
          }
      }
   }); 
  </code></pre>