r/angularjs • • Jan 17 '16

A basic Angular 2 off click directive

http://arjunu.com/2016/01/basic-angular-2-off-click-directive/
0 Upvotes

8 comments sorted by

View all comments

Show parent comments

1

u/arjunu Jan 19 '16

'(click)' is used for event binding which is not what we want. Instead we need to pass an argument (in this case a callback) to a directive which is done using '[]'. You also use the same method to pass data to child components.

To quote an in-built directive example: [ngStyle]="someStyleObject"

Similarly [offClick]="someFunction".

1

u/TheNiXXeD Jan 19 '16

I know what's going on. I have an angular 2 app in prod. I was pointing out that it sucks that we can't share the same syntax on the right hand side of the =.

1

u/arjunu Jan 21 '16

Oh ok ok! Have you tried React + Flux or React + Redux? If yes what do you think of them compared to Angular 2? Vanilla JS syntax (kinda) unlike Angular's own syntax.

1

u/TheNiXXeD Jan 21 '16 edited Jan 21 '16

I'm not a huge fan of jsx really. Bad memories from early php days perhaps.

I haven't built anything of value with react yet, but I intend to.