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 { HttpClient } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
import { Injectable } from '@angular/core'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class EchoService { | |
constructor(private httpClient: HttpClient) {} | |
public makeCall(): Observable<any> { | |
return this.httpClient.get<any>('https://jsonplaceholder.typicode.com/posts/1'); |
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 { Component, OnInit } from '@angular/core'; | |
import { EchoService } from '../echo.service'; | |
import { Observable } from 'rxjs'; | |
@Component({ | |
templateUrl: `second.component.html`, | |
styleUrls: ['./second.component.css'] | |
}) | |
export class SecondComponent implements OnInit { | |
public response: Observable<any>; | |
constructor(private echoService: EchoService) {} |
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
body { | |
margin: 0 auto; | |
max-width: 1000px; | |
background: url('assets/img/sandbox.png') no-repeat center; | |
display: flex; | |
flex-direction: column; | |
height: 100%; | |
font-family: 'Source Sans Pro', calibri, Arial, sans-serif !important; | |
min-height: 550px; | |
} |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>AngularSeo</title> | |
<base href="/"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="icon" type="image/x-icon" href="favicon.ico"> | |
</head> | |
<body> |
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
<template> | |
<div id="app"> | |
<router-view /> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: "app", | |
data: () => { | |
return { |
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
<template> | |
<q-page padding> | |
<div class="text-center"> | |
<h2>Search</h2> | |
</div> | |
<q-form @submit="search" class="q-gutter-md"> | |
<q-input | |
filled | |
v-model="searchData.keyword" | |
label="Keyword *" |
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
<template> | |
<q-page padding> | |
<div class="text-center"> | |
<h2>{{selectedSection | capitalize}}</h2> | |
<q-btn color="primary" label="Sections"> | |
<q-menu> | |
<q-list> | |
<q-item | |
clickable | |
v-close-popup |
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
const axios = require('axios'); | |
const querystring = require('querystring'); | |
const apiUrl = 'https://api.nytimes.com/svc'; | |
const apikey = 'your api key'; | |
export const nytMixin = { | |
methods: { | |
getArticles(section) { | |
return axios.get(`${apiUrl}/topstories/v2/${section}.json?api-key=${apikey}`); | |
}, | |
searchArticles(data) { |
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
<template> | |
<div id="search-results"> | |
<q-card class="my-card bg-secondary text-white" v-for="s in searchResults" :key="s.id"> | |
<q-card-section> | |
<div class="text-h6">{{s.headline.main}}</div> | |
<div class="text-subtitle2">Date: {{s.pub_date | formatDate}}</div> | |
</q-card-section> | |
<q-card-section> | |
<a :href="s.web_url" class="text-white">Link</a> | |
</q-card-section> |
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 Vue from 'vue' | |
import Router from 'vue-router' | |
import DefaultLayout from './layouts/Default.vue' | |
import Home from './views/Home.vue' | |
import Search from './views/Search.vue' | |
Vue.use(Router) | |
export default new Router({ | |
mode: 'history', | |
routes: [ | |
{ |