angular-wiki-search
v1.0.0
Published
AngularJS module for consuming Wikipedia API.
Downloads
1
Readme
#Angular Wiki Search AngularJS module for consuming Wikipedia API.
See it in action: mudroljub.github.io/angular-wiki-search/
Install
Just download the directory and open index.html file. You can also do it developer way:
$ git clone https://github.com/mudroljub/angular-wiki-module.git
$ bower install
$ open index.html
If you don't use Bower, you can manually resolve dependencies from bower.json file.
Enjoy power searching Wikipedia!
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