javascript - Searching NYT API using Angular JS -
I am writing code in angular js, applying a standard application which will show a search field and a search button screen and When the search is running, it should be dragged into a remote result and displayed on the screen. The console is not showing any errors for me, but I am unable to display the results on the screen. I am wondering how I will show results on screen
Here is the code in my JS file
Angular Module ('plunker', []). Controller ('micr ctrl', ['$ scope', '$ Http', function ($ radius, $ http) {var clearError = function (results) {$ scope.error = ""; Return result;}; var apply Data = function (result) {$ scope.articles = result.data; Console.log (result.data);}} var rejected = function (error) {$ scope.error = error.message;}; var getArticles = function () {Var url = "http://api.nytimes.com / SVC / search / v2 / artic? Lesearch.json q = Answer + Korea & amp; API key = 052861d142cf4eb7fa12bb79781fdbe1: 11: 69,591,426" Var promise = $ Http ({method: 'GET', // https://jsonp.nodejitsu.com url: "https://jsonp.nodejitsu.com/?url=" + encodeurIComponent (url)}); promise.success ( ClearError) then (applyData); promise. Panic (work (error } {$ Scope.error = error.message;});}; getArticles (); $ Scope.getRepos = _.debounce (getArticles, 300);}]);
And here is the html code
& Lt; Title & gt; Finger Jess Plunker & lt; / Title & gt; & Lt; Script & gt; Document.write ('& lt; base href =' '+ document.location +' "/>); & lt; / script & gt; & lt; link rel =" stylesheet "href =" style.css "/> & Lt; script data-required =" lodash.js@* "data-save =" 2.4.1 "src =" http://cdnjs.cloudflare.com/ajax/libs/lodash.js/ 2.4.1 / lotus js ">
Comments
Post a Comment