Socket
Socket
Sign inDemoInstall

ng-wiki

Package Overview
Dependencies
5
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-wiki

service provider built for Wikipedia/Angular developers. using free and anonymously Wikipedia REST API service


Version published
Maintainers
1
0

Weekly downloads

Readme

Source

NgWiki

Service provider built for Wikipedia/Angular developers. using free and anonymously Wikipedia REST API service

EDU
  • What did physicist David Mermin mean by his advice, "Shut up and calculate"? If I were forced to sum up in one sentence what the Copenhagen interpretation says to me, it would be “Shut up and calculate!”
  • Richard Feynman was an American theoretical physicist, known for his work in the path integral formulation of quantum mechanics, the theory of quantum electrodynamics, the physics of the superfluidity of supercooled liquid helium

NgWiki - Basic

1. Add NgWiki package to your project

  • Run npm link ng-wiki

2. Import the HttpClientModule in your code

Add HttpClientModule to imports array within your NgModule (usually located at "src/app/app.module.ts")

@NgModule({
  imports: [
    ...
    HttpClientModule
  ],
})

3. Use in your component code

Get specified ('Jupiter') Wikipedia page content
import { Component, OnInit } from '@angular/core';
import { WikiClientService } from 'ng-wiki';

@Component({
  selector: 'app-root',
  template: '<div class="sample"><h1>{{ title }}</h1><h5>page id: {{ id }}</h5><div [innerHTML]="content"></div></div>',
  styleUrls: []
})
export class AppComponent implements OnInit {
  title: string = 'loading';
  id: number = -1;
  content: string = '<p>loding</p>';
  
  constructor(public wikiClient: WikiClientService) {
  }

  ngOnInit(): void {
    this.wikiClient
      .fetchPageOffline('"Hello,_World!"_program')
      .then(page => {
        this.title = page?.title || 'Error';
        this.id = page.id;
        this.content = page?.html || '<p>No page found</p>';
      })
      .catch(err => console.error(err));
  }
}

Keywords

FAQs

Last updated on 23 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc