Skip to content

Instantly share code, notes, and snippets.

View tkssharma's full-sized avatar
🎯
only JS

codewithtkssharma tkssharma

🎯
only JS
View GitHub Profile
import { Component } from '@angular/core';
export class User {
id: number;
name: string;
username: string;
avatar: string;
}
const users: User[] = [
{
"kind": "youtube#searchResult",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/QpOIr3QKlV5EUlzfFcVvDiJT0hw\"",
"id": {
"kind": "youtube#channel",
"channelId": "UCJowOS1R0FnhipXVqEnYU1A"
},
"snippet":{
"publishedAt":"2013-01-25T13:36:19.000Z",
"channelId":"UCpVm7bg6pXKo1Pr6k5kxG9A",
{
"kind": "youtube#searchResult",
"etag": "\"m2yskBQFythfE4irbTIeOgYYfBU/QpOIr3QKlV5EUlzfFcVvDiJT0hw\"",
"id": {
"kind": "youtube#channel",
"channelId": "UCJowOS1R0FnhipXVqEnYU1A"
},
"snippet":{
"publishedAt":"2013-01-25T13:36:19.000Z",
"channelId":"UCpVm7bg6pXKo1Pr6k5kxG9A",
<div>
<MyLabel text={TextLabel} />
<MyTextfield />
<MyButton textlabel='OK' />
</div>
React.createElement("div", null,
React.createElement(MyLabel, {text: TextLabel}),
React.createElement(MyTextfield, null),
React.createElement(MyButton, {textlabel: "OK"}))
<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>
import React from 'react';
function Question(props) {
return (
<div>
<h2 className="question">{props.content}</h2>
</div>
);
}
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>
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({
// 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)