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 } from '@angular/core'; | |
export class User { | |
id: number; | |
name: string; | |
username: string; | |
avatar: string; | |
} | |
const users: User[] = [ |
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
{ | |
"kind": "youtube#searchResult", | |
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/QpOIr3QKlV5EUlzfFcVvDiJT0hw\"", | |
"id": { | |
"kind": "youtube#channel", | |
"channelId": "UCJowOS1R0FnhipXVqEnYU1A" | |
}, | |
"snippet":{ | |
"publishedAt":"2013-01-25T13:36:19.000Z", | |
"channelId":"UCpVm7bg6pXKo1Pr6k5kxG9A", |
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
{ | |
"kind": "youtube#searchResult", | |
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/QpOIr3QKlV5EUlzfFcVvDiJT0hw\"", | |
"id": { | |
"kind": "youtube#channel", | |
"channelId": "UCJowOS1R0FnhipXVqEnYU1A" | |
}, | |
"snippet":{ | |
"publishedAt":"2013-01-25T13:36:19.000Z", | |
"channelId":"UCpVm7bg6pXKo1Pr6k5kxG9A", |
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
<div> | |
<MyLabel text={TextLabel} /> | |
<MyTextfield /> | |
<MyButton textlabel='OK' /> | |
</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
React.createElement("div", null, | |
React.createElement(MyLabel, {text: TextLabel}), | |
React.createElement(MyTextfield, null), | |
React.createElement(MyButton, {textlabel: "OK"})) |
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
<html lang="en"> | |
<head> | |
<script src="//fb.me/react-0.12.2.js"></script> | |
<script src="//fb.me/JSXTransformer-0.12.2.js"></script> | |
<script type="text/jsx" src="example1.jsx"></script> | |
</head> | |
<body> |
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 React from 'react'; | |
function Question(props) { | |
return ( | |
<div> | |
<h2 className="question">{props.content}</h2> | |
</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
return ( | |
<div key={props.questionId} className="quiz-story"> | |
<QuestionCount counter={props.counter} viewreults={props.viewreults} | |
counter={props.questionId} | |
total={props.questionTotal} | |
/> | |
<Question content={props.question} /> | |
<ul className="answerOptions"> | |
{props.answerOptions.map(renderAnswerOptions)} | |
</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
import { Injectable } from '@angular/core' | |
import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpResponse } from '@angular/common/http'; | |
import { Observable } from 'rxjs/Observable'; | |
import 'rxjs/add/operator/do'; | |
@Injectable() | |
export class HeaderInterceptor implements HttpInterceptor { | |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { | |
const dummyrequest = req.clone({ |
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
// src/app/ping/ping.component.ts | |
import { HttpClient } from '@angular/common/http'; | |
// ... | |
export class AppComponent { | |
constructor(public http: HttpClient) {} | |
public ping() { | |
this.http.get('https://example.com/api/things') | |
.subscribe( | |
data => console.log(data), | |
err => console.log(err) |