1. create services in specific folder (like in the Shared folder)
ng g s Shared/myservice
2. use dry run mode (-d) to check the outcome before really execute the command
ng g s shared/myservice -d
3. use --flat to skip generating the folder for the component
ng g c mycomponenet --flat
4. use $ suffix to indicate the variable is an observable
let keyup$=Observable.fromEvent(this.inputField.nativeElement, 'keyup');
5. use hashtag # to uniquely identify the elements in the template
<input type="text" #myInputField >
6. Angular provide a special class ElementRef to directly access the element.
7. use @ViewChild to find the element in the template
@ViewChild('myInputField') myInput : ElementRef;
let inputValue=this.myInput.nativeElement;
more to come..................
No comments:
Post a Comment