index.html http://pastie.org/10777655
app.js http://pastie.org/10777651
我是angularjs的新手。有人可以解决这个问题吗?如果重载网址无效,请重新加载。
查看ngCsv文档后,发现您的应用程序中存在错误。
1)ngCsv模块具有ngSanitize的依赖关系,您没有包含它。
2)ng-csv =“ getArray()”可以是表达式,值或承诺。但是在您的情况下,我认为出了点问题。
var app = angular.module('mainApp',['ngSanitize','ngCsv']);
app.controller('myCtrl',function($scope,$http){
var endpoint = 'http://localhost:8080';
$scope.show_table = true;
$scope.ShowSearchTab= true;
$scope.hideTable = function(){
$scope.show_table = false;
};
$scope.ClickShow = function(){
$scope.ShowSearchTab = true;
};
$scope.test = [
{'companyname':'Company 1', 'streetaddress':'Address 1', 'executive':'exe 1', 'webaddress':'www.example1.com', 'dunsno':'xxx', 'leadid':'yyy'},
{'companyname':'Company 2', 'streetaddress':'Address 2', 'executive':'exe 2', 'webaddress':'www.example2.com', 'dunsno':'xxx', 'leadid':'yyy'},
{'companyname':'Company 3', 'streetaddress':'Address 3', 'executive':'exe 3', 'webaddress':'www.example3.com', 'dunsno':'xxx', 'leadid':'yyy'},
{'companyname':'Company 4', 'streetaddress':'Address 4', 'executive':'exe 4', 'webaddress':'www.example4.com', 'dunsno':'xxx', 'leadid':'yyy'}
]
$scope.getArray = function(){
return $scope.test;
}
});
工作的Plunkr在这里https://plnkr.co/edit/K5l3snujJ3GQtPyjRJLZ?p=preview
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句