View loadcomponentondemand.js
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, HostListener, OnInit, ViewContainerRef } from '@angular/core'; | |
@Component({ | |
selector: 'app-home', | |
templateUrl: './home.component.html', | |
styleUrls: ['./home.component.css'] | |
}) | |
export class HomeComponent implements OnInit { | |
count = 0; |
View servicesingelton5.js
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'; | |
import { RootInjectorGuard } from './root-injector.guard'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class AppService extends RootInjectorGuard { | |
constructor() { | |
super(AppService) |
View servicesingelton3.js
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 { inject, InjectOptions, Type } from "@angular/core"; | |
export class RootInjectorGuard { | |
option: InjectOptions = { | |
skipSelf: true, | |
optional: true | |
}; | |
constructor(type: Type<any>) { | |
console.log(type.name); | |
const parent = inject(type, this.option); |
View servicesingleton2.js
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
@Component({ | |
selector: 'app-fipq', | |
templateUrl: './fipq.component.html', | |
styleUrls: ['./fipq.component.css'], | |
providers: [AppService] | |
}) | |
export class ProductComponent implements OnInit { | |
constructor(private appservice: AppService) { } |
View serviceex.js
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 AppService { | |
constructor() { } | |
} |
View mat.ts
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 { NgModule } from '@angular/core'; | |
import { A11yModule } from '@angular/cdk/a11y'; | |
import { ClipboardModule } from '@angular/cdk/clipboard'; | |
import { DragDropModule } from '@angular/cdk/drag-drop'; | |
import { PortalModule } from '@angular/cdk/portal'; | |
import { CdkStepperModule } from '@angular/cdk/stepper'; | |
import { CdkTableModule } from '@angular/cdk/table'; | |
import { CdkTreeModule } from '@angular/cdk/tree'; | |
import { MatAutocompleteModule } from '@angular/material/autocomplete'; | |
import { MatBadgeModule } from '@angular/material/badge'; |
View a.json
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
const products : IProductDetails[] = [ | |
{ | |
product:{ | |
Id: 1, | |
Title: 'Pen', | |
Price: 100 | |
}, | |
inStock:true, | |
Qyanity: 100, | |
Color: "Red", |
View thisinjs.js
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
function Product(title,price){ | |
this.title = title; | |
this.price = price; | |
console.log(this); | |
} | |
// call a function as method - MIP | |
// value of this inside function - always object before dot |
View delete.js
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
let c1 = data.findIndex( t => Object.keys(t)[0] == d.type); | |
if(c1 > -1){ | |
if(data[c1][d.type].length >1){ | |
const index = data[c1][d.type].indexOf(d.title); | |
if (index > -1) { | |
data[c1][d.type].splice(index, 1); | |
} | |
} | |
else{ | |
const index = data[c1][d.type].indexOf(d.title); |
View code.js
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
private filterDataSource: BehaviorSubject<Array<any>> = new BehaviorSubject([]); | |
public filterData = this.filterDataSource.asObservable(); | |
updateUserData(data) { | |
this.filterDataSource.next(data); | |
} | |
addData(dataObj) { | |
const currentValue = this.filterDataSource.value; |
NewerOlder