-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Make props accessible without bindings, inspired by React #13698
Comments
Like this idea a lot. However, one thing I think is more beneficial here comes from React's This example makes an assumption that two-way binding is assumed: .component('counter', {
bindings: {
count: angular.scopeType.number
},
template: '<div>Count: {{counter.props.count}}</div>',
}) And maybe another idea to implement type validation and binding info: .component('counter', {
bindings: {
count: ['=', angular.scopeType.number]
},
template: '<div>Count: {{counter.props.count}}</div>',
}) |
👍 |
Already possible in angular 2 http://victorsavkin.com/post/119943127151/angular-2-template-syntax |
This is yet another reason to start the upgrade to Angular 2. |
@petebacondarwin Indeed! Excited for those changes. Some form of support for 1.x apps could potentially be considered though, especially large enterprise apps that will gradually be making code upgrades to get closer and closer to 2 as possible before leaving 1.x! |
@valorkin Does Angular 2 allow the same props-syntax without controller? I could not find it in that article. |
@dmitriz no controller - no problem :) |
@valorkin Would you mind giving a more detailed description of what you have in mind? How would you implement the above proposals in Angular 2? I don't see it without controller. |
This is similar to #11657 |
Please, take into consideration not wrapping functions when implementing that feature. That would be helpful in scenarios like the one below and to everyone migrating their controllers to isolated components: |
@LulzAugusto - I don't understand your use case. Can you respond to my comments on SO? |
@petebacondarwin I just edited the question. Thanks for your help |
Does angular 4+ version has this feature? @dmitriz @LulzAugusto |
Having seen how easy it is to access Props in React, I can't help to request the same awesome feature in Angular:
I would dream to avoid the clunky binding declarations and have the same level of simplicity:
Opinions?
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>The text was updated successfully, but these errors were encountered: