This file contains 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: '[app-ch-color]' | |
}) | |
export class bgDirective{ | |
constructor(private el: ElementRef, private renderer: Renderer){ | |
this.changeColor('red'); | |
} | |
changeColor(color: string){ |
This file contains 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
<div app-ch-color> | |
Hello Nepal!!! | |
</div> | |
<div> | |
Hello Nepal!!! (No Custom Attribute applied) | |
</div> |
This file contains 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, HostListener } from "@angular/core"; | |
@Directive({ | |
selector: '[app-ch-color]' | |
}) | |
export class bgDirective{ | |
constructor(private el: ElementRef, private renderer: Renderer){ | |
this.changeColor('red'); | |
} | |
@HostListener('click') foo(){ |
This file contains 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, HostListener } from "@angular/core"; | |
@Directive({ | |
selector: '[app-ch-color]' | |
}) | |
export class bgDirective{ | |
constructor(private el: ElementRef, private renderer: Renderer){ | |
this.changeColor('red'); | |
} | |
@HostBinding('style.border') border : string; |
This file contains 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,Input,OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'appchild', | |
template: `<h2>Hi {{message}}</h2>` | |
}) | |
export class ChildComponent implements OnInit{ | |
_message: string; | |
constructor(){ |
This file contains 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 } from '@angular/core'; | |
@Component({ | |
selector: 'my-app', | |
template: `<h1>Hello {{pmessage}}</h1> | |
<appchild [message]="cmessage"></appchild> | |
` | |
}) | |
export class AppComponent { | |
This file contains 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,Input,OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'appchild', | |
template: `<h2>Hi {{message}}</h2>` | |
}) | |
export class ChildComponent implements OnInit{ | |
_message: string; | |
constructor(){ |
This file contains 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,Input,OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'appchild', | |
template: `<h2>Hi {{message}}</h2>` | |
}) | |
export class ChildComponent implements OnInit{ | |
_message: string; | |
constructor(){ |
This file contains 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, EventEmitter, Output } from '@angular/core'; | |
@Component({ | |
selector: 'app-child', | |
template: `<button class='btn btn-primary' (click)="food()">Click me</button> ` | |
}) | |
export class AppChildComponent { | |
@Output() foo = new EventEmitter(); | |
index = 0; |
This file contains 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
[<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Pract</title> | |
<base href="/"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha3-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="icon" type="image/x-icon" href="favicon.ico"> | |
</head> |
OlderNewer