🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

AngularJS module for consuming Wikipedia API.

Plugins

Documentation

Angular Wiki Search

AngularJS module for consuming Wikipedia API.

See it in action: mudroljub.github.io/angular-wiki-search

You can find an advanced version here: github.com/mudroljub/power-wiki-search

Install

Just download the directory and open index.html file:

$ git clone https://github.com/mudroljub/angular-wiki-search.git $ bower install $ open index.html

If you don't use Bower, you can manually resolve dependencies from bower.json file.

Documentation

The main WikiController consists of two main public methods:

  • wiki.openArticle(title)
  • wiki.searchWikipedia(term)

Those methods getting data from Wikipedia API in JSONP format (see API documentation).

Both methods have those common URL params:

var params = {     action: 'query',     prop: 'extracts|pageimages',    // get article's content and images     format: 'json',     formatversion: 2,  // support utf-8     callback: 'JSON_CALLBACK' }

Specific params for openArticle method are:

{     titles: title,   // title is a variable     redirects: ''  // auto-redirecting to an article }

Specific params for searchWikipedia method are:

{     generator: 'search',     gsrsearch: term,  // term is a variable     pilimit: 'max', // enable images for all results     exlimit: 'max', // enable content for all results     exintro: ''    // get only article's intro }

To-do list

  • error handling

You May Also Like