Callback function of a widget

97 views
Skip to first unread message

Witold Szczerba

unread,
Dec 27, 2011, 6:00:30 PM12/27/11
to ang...@googlegroups.com
Hi there,
I have just added comment here:

http://code.angularjs.org/0.10.5/docs-0.10.5/guide/dev_guide.compiler.widgets.creating_widgets

but it seems volatile, as this comment is attached explicitly to 10.5
release, so maybe no one would read it before new release shows up, so
I am reposting it here:

Compare these two:

angular.widget('my:watch', function(compileElement) {...});
angular.widget('@ my:watch', function(expression, compileElement) {...});

I think, the 'expression' parameter for attribute widget should go
after compileElement, so these two callback functions would look
exactly the same when expression is not declared.

I am writing this, because it forced me several times already to debug
and fix the problem, because I was either switching from element- to
attribute-widget or I was creating new one based on previous and
always the same: compileElement equals empty string - because it
becomes an expression.

Regards,
Witold Szczerba

Vojta Jina

unread,
Dec 27, 2011, 8:30:30 PM12/27/11
to ang...@googlegroups.com
Hey Witold, we are currently rewriting the whole compiler (you can see it here: https://github.com/angular/angular.js/pull/685).
With new compiler, the world will be completely different, much better. Actually, it's gonna be totally awesome :-D

Seriously, we know it's confusing now. There won't be widgets, attr widgets, directives... everything will be just a directive - simple.
You can define only linking function (without tpl fn), as that's what you need most of time.
You can specify html markup template (declarative, instead of imperative creating some DOM structure)...

We hope, this will make things easier, especially writing simple directives...

V.

Di Peng

unread,
Dec 27, 2011, 8:39:28 PM12/27/11
to ang...@googlegroups.com
Can't wait for that to happen !!
Vojta, is it gonna be within next few releases?
Di

--
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/-/q-DLCPnUiaMJ.

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.

Vojta Jina

unread,
Dec 27, 2011, 9:05:00 PM12/27/11
to ang...@googlegroups.com
It's definitely gonna be in Angular v1.0, which we all can't wait to happen, trust me :-D

V.

Chris Odney

unread,
Dec 28, 2011, 3:00:25 AM12/28/11
to AngularJS
This is great news!

Chris.

Chris Odney

unread,
Dec 28, 2011, 3:04:16 AM12/28/11
to AngularJS
Just curious, how will the ordering be taken care of if everything is
a directive?

Chris.

Misko Hevery

unread,
Dec 28, 2011, 2:00:56 PM12/28/11
to ang...@googlegroups.com
See preliminary docs here: http://ci.angularjs.org/job/angular.js-misko/ws/build/docs/index.html#!/api/angular.module.ng.$compileProvider.directive

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
Reply all
Reply to author
Forward
0 new messages