This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //pass a query param | |
| onNavigate(){ | |
| this.router.navigate(['/'],{queryParams:{"analytics":100}}); | |
| } | |
| //get a query param in that component, here it is / so it refers to main or home compnent | |
| import { Component, OnInit,OnDestroy } from '@angular/core'; | |
| import {Router} from '@angular/router'; | |
| import {Subscription} from 'rxjs/Rx'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Component, OnInit, OnDestroy } from '@angular/core'; | |
| import {Router,ActivatedRoute} from '@angular/router'; | |
| import {Subscription} from 'rxjs/Rx'; | |
| @Component({ | |
| selector: 'component name', | |
| template: `<h1>user component</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //this directie uses templateref,viewcontainer ref ..and works exact opposit of *ngif | |
| import { Directive, TemplateRef, ViewContainerRef,Input } from '@angular/core'; | |
| @Directive({ | |
| selector:'[unless]' | |
| }) | |
| export class UnlessDirective{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Directive ,HostListener,HostBinding } from '@angular/core'; | |
| @Directive({ | |
| selector: '[highlight]', //element having hightlight [attribute] is selected or .class or #id or component | |
| }) | |
| export class HighlightDirective { | |
| @HostListener('mouseenter') mouseover(){ | |
| this.backgroundColor = 'green'; | |
| //can use renderer here to change style here | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Directive ,ElementRef, Renderer } from '@angular/core'; | |
| @Directive({ | |
| selector: '[highlight]', //element having hightlight [attribute] is selected or .class or #id or component | |
| }) | |
| export class HighlightDirective { | |
| constructor(private elementRef: ElementRef,private renderer:Renderer) { | |
| // this.elementRef.nativeElement.style.color = 'red'; | |
| this.renderer.setElementStyle(this.elementRef.nativeElement,'background-color','red'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function rules() | |
| { | |
| return [ | |
| // username and password are both required | |
| [['password','username'], 'required'], | |
| [['username'],'validateUsername'], | |
| // rememberMe must be a boolean value | |
| //['rememberMe', 'boolean'], | |
| // password is validated by validatePassword() | |
| ['password', 'validatePassword', 'skipOnError' => false], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In phpmyadmin select all tables of your database. | |
| From the dropdown 'With selected:' choose 'Replace table prefix' | |
| Set from->to replacement. | |
| DONE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo npm cache clean -f | |
| sudo npm install -g n | |
| sudo n stable | |
| sudo ln -sf /usr/local/n/versions/node/<VERSION>/bin/node /usr/bin/node | |
| **for latest version** | |
| sudo n latest |