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 class = 'jumbotron'> | |
<button class = 'btn btn-info'> Hey </button> | |
<h1>Welcome to Angular</h1> | |
<table class = 'table'> | |
<tr> | |
<td> With bootstrap</td> | |
</tr> | |
</table> | |
</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
<div> | |
<button> Hey </button> | |
<h1>Welcome to Angular</h1> | |
<table> | |
<tr> | |
<td> No bootstrap</td> | |
</tr> | |
</table> | |
</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
loginForm: FormGroup; | |
ngOnInit() | |
this.loginForm = new FormGroup({ | |
email: new FormControl(null), | |
password: new FormControl(null), | |
age: new FormControl(null) | |
}); | |
} |
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
<form (ngSubmit)='loginUser()' [formGroup]='loginForm' novalidate class="form"> | |
<input formControlName='email' type="text" class="form-control" placeholder="Enter Email" /> | |
<br /> | |
<input formControlName='password' type="password" class="form-control" placeholder="Enter Password" /> <br /> | |
<input formControlName='age' type="number" class="form-control" placeholder="Enter Age" /> | |
<br /> | |
<button [disabled]='loginForm.invalid' class="btn btn-default">Login</button> | |
</form> |
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
ngOnInit() { | |
this.loginForm = new FormGroup({ | |
email: new FormControl(null, [Validators.required]), | |
password: new FormControl(null, [Validators.required, Validators.maxLength(8)]), | |
class: new FormControl(null) | |
}); | |
} |
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
<input formControlName='Class' type="number" class="form-control" placeholder="Enter Class" /> | |
<div class="alert alert-danger" *ngIf="loginForm.get('class').dirty && loginForm.get('class').errors && loginForm.get(‘class’).errors.classRange "> | |
Class should be in between 1 to 12 | |
</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
<input type = "text placeholder = "What is your name?" #name> | |
<button (click) = display(name)>What is the name? </button> |
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, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: 'app.component.html' | |
}) | |
export class AppComponent { | |
display(name: HTMLInputElement){ | |
console.log(name.value); | |
} |
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 {Injectable} from '@angular/core'; | |
@Injectable() | |
export class ProductService{ | |
getProducts(){ | |
return; | |
} | |
} |
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 {Injectable} from '@angular/core'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class ProductService{ | |
getProducts(){} | |
} |