Javascript

I read about Mozilla events , here we are talking about "Inline event handlers" that should not be used and are considered bad practice.

eg.

<button onclick="bgChange()">Press me</button>

However, in frameworks like Angular, we do something like:

<my-component (click)="onClick($event)"></my-component>

Isn't that contrary to what Mozilla considers bad practice in this case?

If this question needs to be asked in another section, please let me know.

+4
source share
1 answer

This is a “separation of concerns” issue, and your component is usually split into a file, which then contains the “control” of that component.

Directives

Angular is basically an idea that builds on this in your templates.

html (, angular) html- javascript --- , , .

, angular " javascript javascript" "html html".

MVC

https://www.safaribooksonline.com/library/view/programming-javascript-applications/9781491950289/ch05.html

Angular MVC " ", ".

0

Source: https://habr.com/ru/post/1691512/


All Articles