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
export default class Youtube implements OnInit { | |
Videos : video[]; | |
loaded : boolean; | |
API_KEY : string; | |
selectVideo : video; | |
opts : any; | |
constructor() { | |
} | |
ngOnInit() { |
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
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; | |
@Component({ | |
selector: 'search-bar', | |
template: '<div class="search-bar" > <input [(ngModel)]="searchText" (change)="handleChange()" /></div>' | |
}) | |
export default class SearchBar implements OnInit { | |
@Output() searchTextChange = new EventEmitter(); | |
searchText: string; |
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
<ng-loader [loaded]="loaded"></ng-loader> | |
<search-bar (searchTextChange)="SearchValueChange($event);"></search-bar> | |
<div class="container"> | |
<div class="left"> | |
<video-detail [selectVideo]="selectVideo"></video-detail> | |
</div> | |
<div class="right"> | |
<video-list [Videos]="Videos"></video-list> | |
</div> |
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: 'video-list', | |
templateUrl: 'video-list.html' | |
}) | |
class VideoList implements OnInit { | |
@Input() Videos:video[] ; | |
ngOnInit(){ | |
console.log(this.Videos); | |
} |
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
import ReactDOM from 'react-dom' | |
import React from 'react' | |
import { BrowserRouter, Switch, Route, NavLink } from 'react-router-dom' | |
import { Home, BasicRouting, Blocking } from './Components' | |
ReactDOM.render( | |
<BrowserRouter> | |
<div> | |
<ul> | |
<li><NavLink to="/" activeClassName="active">Home</NavLink></li> |
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
<BrowserRouter> | |
<div> | |
<ul> | |
<li><NavLink to="/" activeClassName="active">Home</NavLink></li> | |
<li><NavLink to="/basic-routing" activeClassName="active">BasicRouting</NavLink></li> | |
<li><NavLink to="/blocking" activeClassName="active">Blocking</NavLink></li> | |
<li><NavLink to="/miss" activeClassName="active">Miss</NavLink></li> | |
<li><NavLink to="/query-params" activeClassName="active">Query Params</NavLink></li> | |
<li><NavLink to="/recursive-paths" activeClassName="active">Recursive Paths</NavLink></li> | |
</ul> |
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
export default class BasicRouting extends Component { | |
render() { | |
return ( | |
<div> | |
<h1>BasicRouting</h1> | |
<div className="leftNavi"> | |
<ul> | |
<li><Link to={this.props.match.url +"/level1"} className="active">Level 1</Link></li> | |
<li><Link to={this.props.match.url + "/level2"} className="active">Level 2</Link></li> | |
</ul> |
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
render() { | |
const { location, pattern, match, isExact } = this.props | |
return ( | |
<div> | |
<h1>Reading the query parameters.</h1> | |
<div className="leftNavi"> | |
<ul> | |
<li><Link to={{ | |
pathname: match.url+'/level1', | |
search: '?abc=23' |
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
import { Component, Input, OnInit, Output, EventEmitter } from '@angular/core'; | |
@Component | |
({ | |
selector: 'search-bar', | |
template: '<div class="search-bar" ><input [(ngModel)]="searchText" (change)="handleChange()" /></div>' . | |
}) | |
export default class SearchBar implements OnInit { | |
@Output() searchTextChange = new EventEmitter(); |
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: 'youtube', templateUrl: './youtube.html'}) | |
export default class Youtube implements OnInit { | |
Videos : video[]; | |
loaded : boolean; | |
API_KEY : string; | |
selectVideo : video; | |
opts : any; | |
constructor() { |