Angular_Day2
Angular_Day2
“formerly Angular 4”
Benefits worth the cost
cd projectname
ng serve –p port –o
ng g component componentName
etc.
Angular Project Structure
All images, stylesheets, JavaScript etc.. Reside here
What is rendered
Configuration Files
Component Logic
Entry point for the app
App Starting Point
• Main.ts file is entry point of our application.
main.ts • Main.ts file bootstrap app.module.ts file
Example:
{{ 1 + 1 }}
{{ 946757880 | date : ‘medium’ }}
{{ user.name }}
{{[1,2,3][0]+1}}
The Main Building Elements
Module
Component
Metadata
Template
Data Binding
Directive
Pipes
Service
Angular Module
An Angular Module is a class decorated by
@NgModule
Bootstrap a component
Metadata/Decorator
(describe the component)
Header Component
Nav
App Component
Content Component
Component
Footer Component
Template
A template is HTML that tells Angular
how to render a component
Templates include data bindings as well
as other components and directives
Angular leverages native DOM events and
properties which dramatically reduces
the need for a ton of built-in directives
Angular leverages shadow DOM to do
some really interesting things with view
encapsulation
Template
Inline Templates
template defines an embedded template
string
Use back-ticks for multi-line strings
Linked Templates
templateUrl links the Component to its
Template
Data-Binding