23
loading...
This website collects cookies to deliver better user experience
class
instead of className
.ng g c <name>
to create a component. This basically generates a component in the current directory. By default it creates four files:<li>
. In react one can directly use a forEach like this:*ngFor
attribute:fetch
or axios
and write the code in the component itself. For larger applications I make a custom http hook and reuse it. In angular we use the httpModule
and unlike react all the api calls for a component are written in services
. ng g s <name>
. This creates a service file and then add your api calls in this file.