Preloading in Angular means loading the Lazy loaded Modules in the background asynchronously, while user is interacting with the app. This will help boost up the loading time of the app
const app_routes: Routes = [
import { Directive, HostListener } from '@angular/core'; | |
@Directive({ | |
selector: '[appBlockCopyPaste]' | |
}) | |
export class BlockCopyPasteDirective { | |
constructor() { } | |
@HostListener('paste', ['$event']) blockPaste(e: KeyboardEvent) { | |
e.preventDefault(); |
public onlineOffline: boolean = navigator.onLine; | |
constructor(.......) | |
................ | |
................ | |
ngOnInit() { | |
window.addEventListener('online', () => { | |
this.onlineOffline = true; | |
}); |
Sass (which stands for Syntactically Awesome Style Sheets) is an extension to CSS.
sass is superset of css Sass is syntatic sugar of css It helps in writing CSS quickly.
To enable HashLocationStrategy in an Angular application we pass {useHash: true} when we are providing our routes with RouterModule, like so:
TypeScript RouterModule.forRoot(routes, {useHash: true})
http://somedomain.com/page#routing-strategies Taking a look at the app we’ve built so far, if running locally the URLs look something like:
localhost:4040/#/search localhost:4040/#/artist/1234/tracks
Including the CUSTOM_ELEMENTS_SCHEMA in the module allows the use of the web components in the HTML markup without the compiler producing errors
-
).-
)./* | |
##Device = Desktops | |
##Screen = 1281px to higher resolution desktops | |
*/ | |
@media (min-width: 1281px) { | |
//CSS | |
var params = { | |
a: 1, | |
b: 2, | |
c: 3 | |
}; | |
var queryString = Object.keys(params).map(key => key + '=' + params[key]).join('&'); | |
// or | |
var queryString = Object.keys(params).map(function(key) { |
environments ├── environment.staging.ts
angular.json
"configurations": {
"staging": { "fileReplacements": [
"configurations": { | |
"production": { ... }, | |
"staging": { | |
"fileReplacements": [ | |
{ | |
"replace": "src/environments/environment.ts", | |
"with": "src/environments/environment.staging.ts" | |
} | |
] | |
} |