The part about "where the attribute name is the same as the value" is
related to whether you want the name of the isolate scope property to be
the same as the camel-cased name of the attribute where it gets its value.
You named your isolate scope property customerInfo, but the name of the
attribute that supplies its value is info. If you want to stick with those
names then you need to specify the directive scope like this:

scope: {
  customerInfo: '=info'
}


On Sun, Feb 2, 2014 at 1:40 PM, Marc B <[email protected]> wrote:

> 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.
>



-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
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