Hello,

Learning about Directives and am stuck with cases where the attribute's 
name is the same as the value.

The docs on custom directives @ http://docs.angularjs.org/guide/directivesay 
about *isolate 
scope* property:

given below html:

    <div ng-controller="Ctrl">
      <my-customer info="naomi"></my-customer>
      <hr>
      <my-customer info="igor"></my-customer>
    </div>


and this controller/directive:

angular.module('docsIsolateScopeDirective', [])
.controller('Ctrl', function($scope) {
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
$scope.igor = { name: 'Igor', address: '123 Somewhere' };
})
.directive('myCustomer', function() {
return {
restrict: 'E',
scope: {
customerInfo: '='
},
templateUrl: 'my-customer-iso.html'
};
});

the resulting output is:

Name: Naomi Address: 1600 Amphitheatre 
------------------------------
Name: Igor Address: 123 Somewhere  

But then it says:

For cases where the attribute name is the same as the value you want to 
bind to inside the directive's scope, you can use this shorthand syntax:

...
scope: {
  // same as '=customer'
  customer: '='
},
...

 
 I don't understand  how the html shoul look like in this case. Anyway, the 
below doesn't work:

    <div ng-controller="Ctrl">
      <my-customer ="naomi"></my-customer>
      <hr>
      <my-customer ="igor"></my-customer>
    </div>


this notation makes sense but it is not what is meant by "where the 
attribute name is the same as the value". Is this a case where attribute 
name is the same as the value <my-customer igor="igor"></my-customer>????


What is meant here and how does the html look?

Thanks


Marc

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to