Created
July 9, 2020 11:32
-
-
Save thisiszoaib/a038174bbf1e87aee285542d2b96c6a2 to your computer and use it in GitHub Desktop.
Weather 2
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
| @Component({ | |
| selector: "app-root", | |
| templateUrl: "./app.component.html", | |
| styleUrls: ["./app.component.scss"] | |
| }) | |
| export class AppComponent implements OnInit, OnDestroy { | |
| cities = ["London", "Paris", "Moscow", "New York", "Karachi", "Sydney"]; | |
| cityControl: FormControl; | |
| constructor(private router: Router) {} | |
| ngOnInit() { | |
| this.cityControl = new FormControl(""); | |
| this.cityControl.valueChanges | |
| .subscribe(value => { | |
| this.router.navigate([value]); | |
| }); | |
| } | |
| ngOnDestroy() { | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment