Custom directive - binding variable to scope in latest release

6,013 views
Skip to first unread message

bsr...@gmail.com

unread,
Jun 20, 2012, 11:18:17 PM6/20/12
to ang...@googlegroups.com
Hello.

I was following tutorial on directive
by John Lindquist. It works with angular-1.0.0rc5.js, but throws exception with 1.0 release.
Looks like the way binding the variable is changed. I couldn't really follow the manual.

thanks in advance.

angular.module('components',[])
.directive('helloWorld', function(){
return{
restrict: 'E',
scope:{
name: 'bind',
},
template: '<span>Hello {{name}}..</span>'
}
});

angular.module('HelloApp', ['components'])

Error: Invalid isolate scope definition for directive helloWorld: bind
    at Error (unknown source)
    at file:///test/directive3/js/angular.js:4177:23
    at forEach (file:///test/directive3/js/angular.js:117:20)

jeffau...@ymail.com

unread,
Jun 20, 2012, 11:26:59 PM6/20/12
to ang...@googlegroups.com
Yes, it's been updated. Check the recently updated docs:

http://docs.angularjs.org/guide/directive

Now you should use "@", "=", or "&"

For example:

scope {
     name:"@"

John Lindquist

unread,
Jun 21, 2012, 12:41:02 AM6/21/12
to ang...@googlegroups.com
Thanks for pointing that out, I need to go back and add some popups or something to the video.

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/-OEpzzWNUl0J.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

mark.hol...@gmail.com

unread,
Jul 13, 2012, 7:46:53 AM7/13/12
to ang...@googlegroups.com
Even though that have been changed in the docs, the example just above the "Creating Components" heading still has the wrong scope declarations.
To unsubscribe from this group, send email to angular+unsubscribe@googlegroups.com.

jan.dr...@gmail.com

unread,
Dec 20, 2012, 8:29:53 AM12/20/12
to ang...@googlegroups.com
Where in the documentation does it say to use  "@", "=", or "&" for binding? 

jan.dr...@gmail.com

unread,
Dec 20, 2012, 8:30:43 AM12/20/12
to ang...@googlegroups.com, jan.dr...@gmail.com
never mind I found it. 
Reply all
Reply to author
Forward
0 new messages