我已经在那里我宣布,我想在一个脚本在HTML中使用一个变量js文件访问一个js文件的变量上的HTML文件
js文件(controllerB.js)
var modalArticles = [];
$(document).ready(function() {
$.ajax({
url: "https://newsapi.org/v1/articles?source=google-news&sortBy=top&apiKey=*****"
}).then(function (data) {
modalArticles = data.articles;
})
})
HTML文件
Newsconsole.log('print: ' + modalArticles);
modalArticles是HTML空
+0
这样的事情? http://plnkr.co/edit/oyThCOliuBHVFBgYZQTg?p=preview –