Pankaj Parkar
Indian | 30 | Ex MVP | Angular GDE
Technical Lead, Synerzip
@pankajparkar
@pankajparkar
@pankajparkar
@pankajparkar
<!doctype html>
<html lang="en">
<head>
...
</head>
<body>
<af-root></af-root>
<script src="polyfills-es5.3aa54d3e5134f5b5b842.js" nomodule defer></script>
<script src="polyfills-es2015.fd917e7c3ed57f282ee5.js" type="module"></script>
<script src="runtime-es2015.24b02acc1f369d9b9f37.js" type="module"></script>
<script src="main-es2015.1ac15946a081f21dbbe6.js" type="module"></script>
<script src="runtime-es5.24b02acc1f369d9b9f37.js" nomodule defer></script>
<script src="main-es5.1ac15946a081f21dbbe6.js" nomodule defer></script>
</body>
</html>
Final bundle would have es2015 and es5 bundles
@pankajparkar
const routes: Routes = [
{
path: 'customers',
loadChildren: () => './customers/customers.module#CustomersModule')
},
{
path: 'orders',
loadChildren: () => './orders/orders.module#OrdersModule')
},
{
path: '',
redirectTo: '',
pathMatch: 'full'
}
];
@pankajparkar
const routes: Routes = [
{
path: 'customers',
loadChildren: () => import('./customers/customers.module')
.then(mod => mod.CustomersModule)
},
{
path: 'orders',
loadChildren: () => import('./orders/orders.module')
.then(mod => mod.OrdersModule)
},
{
path: '',
redirectTo: '',
pathMatch: 'full'
}
];
@Component({
selector: 'svg-icon',
templateUrl: './svg.component.html',
styleUrls: ['./svg.component.scss']
})
export class SvgComponent {
@Input() name: String;
constructor() {}
get absUrl() {
return window.location.href;
}
}
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<use [attr.xlink:href]="absUrl + '#' + name"></use>
</svg>
@pankajparkar
@Component({
selector: 'svg-icon',
templateUrl: './icon.component.svg',
styleUrls: ['./svg.component.scss']
})
export class SvgComponent {
...
}
@pankajparkar
{
compilerOptions: {
...
},
"angularCompilerOptions": {
"enableIvy": true
}
}
tsconfig.app.json
@pankajparkar
@pankajparkar
@pankajparkar
ng eject
@pankajparkar
@pankajparkar
import { BuilderOutput, createBuilder } from '@angular-devkit/architect';
export default createBuilder((options, context) => {
return new Promise<BuilderOutput>(resolve => {
resolve({ success: true });
});
});
{
"builders": {
"command": {
"implementation": "./command",
"schema": "./command/schema.json",
"description": "Runs any command line in the operating system."
}
}
}
"builder-test": {
"architect": {
"touch": {
"builder": "@example/command-runner:command",
"options": {
"command": "touch",
"args": [
"src/main.ts"
]
}
}
}
}
@pankajparkar
Host | Package |
---|---|
Firebase hosting | @azure/ng-deploy |
Now | @zeit/ng-deploy |
GitHub pages | @netlify-builder/deploy |
Netlify | angular-cli-ghpages |
ng add packageName
@pankajparkar
validateFormAndDisplayErrors(form: FormGroup) {
Object.keys(form.controls).map((controlName) => {
form.get(controlName).markAsTouched({onlySelf: true});
});
}
form.markAllAsTouched()
@pankajparkar
while (formArray.length) {
formArray.removeAt(0);
}
formArray.clear()
@pankajparkar
@pankajparkar
@pankajparkar
By Pankaj Parkar