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
// app-parent.ts | |
@Component({ | |
selector: 'example-parent', | |
template: `./example-parent.html`, | |
styleUrls: ['./parent.component.css'] | |
}) | |
export class ParentComponent implements OnInit { | |
formBroadcast: Subject<FormGroup> = new BehaviorSubject(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
<!-- app-parent.html --> | |
<div> | |
<app-form-component [(form)]="form" /> | |
</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
<!-- child-form-component.html --> | |
<form [formGroup]="form"> | |
<label> | |
First Name: | |
<input type="text" formControlName="name" /> | |
</label> | |
<label> | |
Last Name: | |
<input type="number" formControlName="age" /> |
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
// child-form-component.ts | |
@Component({ | |
selector: "child-form-component", | |
templateUrl: "./child-form.component.html" | |
}) | |
export class ChildFormComponent implements OnInit { | |
_formValue: FormGroup; | |
@Input() | |
get form() { | |
return this._formValue; |
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: "example-component", | |
templateUrl: "./example.html" | |
}) | |
export class ExampleComponent implements OnInit { | |
_objectValue: any; | |
@Input() | |
get object() { | |
return this._objectValue; | |
} |
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 CustomFeature from “path-to-file”; |
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 React from "react"; | |
export default class LazilyLoadedCustomFeature extends Component { | |
state = { | |
content: null | |
}; | |
componentDidMount() { | |
import(pathtofile).then(e => { | |
this.setState({ content: e }); | |
}); |
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(pathtofile).then(e => { | |
console.log("module loaded!"); | |
}); |
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 { SelectionModel } from "@angular/cdk/collections"; | |
@Component(...metaData) | |
export class AppComponent implements OnInit { | |
constructor(peopleSelection: PeopleSelectionService) {} | |
ngOnInit(): void { | |
this.peopleSelection.selection.changed.subscribe(e => { | |
console.log(`I have received a value ${e}`); | |
}); | |
} |
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
@Injectable({ | |
providedIn: "root" | |
}) | |
export class SingletonRootService {} |
NewerOlder