framework Flashcards
to export (make it public available) a module:
thatfile.js
export default{ foo:’hello’ }
to import a module:
thisfile.js:
import thatfile from ‘./thatfile’
console.log(b.foo);
Problems with ES2015 Modules
Duplicate Modules
Circular Dependency
Harder to manage overall
Angular Modules
not a replacement for ES2015 Modules
groups modules by feature
Angular Module in the right way
A module is imported once and then all the connected modules has its content available
it is a common practice to organice our modules in forlders
The name of the file is the name of the module along with the “.module.ts” string
A module is a type of
Class
import NgModule module and add the decorator
to declare the class as a module
Import BrowserModule
to tell Angular to run the app in a browser enviroment
A module allow us to wrapp many dependencies in to one module/file
so that this could be easily imported into others modules
Component
Reusable custom HTML tag with custom behaviour
A component renders
into a tag inner the DOM
Selector name should be
lowercase with only dashes to separte the words
‘app-root’ component
default component (tag or selector) to bootstrap an angular app
The template section is
valid html