Angular 14
Angular 14
will be rendered
code/first-app/angular-hello-world/src/index.html
Service Module contains only services (can be utility services)must be present only at
the root module
app.module.ts parent, all other modules will be directly or indirectly part of this
module. Only one root module is allowed in an application.
A module is a class decorated with @NgModule. It serves as a registry (aka container)
for all the components, pipes, directives and providers in your application.
will register BrowserModule with that specific angular module instead of the entire Angular
framework.
D:\devenv\ng14\model>node --version
v16.15.1
D:\devenv\ng14\model>npm -v
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.11.0
D:\devenv\ng14\angular14-crud\material-pro-angular-lite-master\angular-14>ng generate
module contacts --routing
DEPRECATED: The 'defaultProject' workspace option has been deprecated. The project to use
will be determined from the current working directory.
CREATE src/app/contacts/contacts-routing.module.ts (251 bytes)
CREATE src/app/contacts/contacts.module.ts (288 bytes)
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch(err => console.log(err));
environment.prod.ts
export const environment = {
production: true
};
environment.ts
export const environment = {
production: false
};
.angular-cli.json
{
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": ["assets", "favicon.ico"],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"prefix": "app",
"styles": ["styles.css"],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
]
}
* is only for the shorthand syntax for structural directives where you can for example use
<div *ngFor="let item of items">{{item}}</div>
Angular NgModel
Angular NgModel is an inbuilt directive that creates a FormControl instance from
the domain model and binds it to a form control element.
The ngmodel directive binds the value of HTML controls (input, select,
textarea) to application data.
The two-way binding uses the syntax of property binding and event binding
together. Property binding uses the syntax as bracket [] or bind- and event
binding uses the syntax as the parenthesis () or on- and these bindings are
considered one-way binding.
https://www.learmoreseekmore.com/
2022/06/angular-14-crud-example.html
ng new firstapp
http://localhost:3000/fruits
{
"fruits":[
{
"id": "1",
"Name": "Mango",
"Quantity": 10,
"Price": 300
}
node_modules\bootstrap\dist\css\ bootstrap.min.css
node_modules\bootstrap\dist\js\ bootstrap.min.js