我有寻呼机指令,它取决于在控制器中接收异步的数据。由于寻呼机需要知道总计数以正确渲染页面,我想隐藏整个寻呼机,直到下载异步数据,然后显示它(但在显示之前,运行链接功能以设置寻呼机信息)以及数据。
这怎么可能?
(function () {
'use strict';
angular
.module('App.widgets')
.directive('customPager', customPager);
function customPager() {
var pager = {
scope: {
pageIndex: '=',
pageSize: '=',
recordCount: '=',
pageClick: '&onPageClick'
},
replace: true,
restrict: 'E',
templateUrl: 'custom-pager.html',
link: link
}
return pager;
function link(scope) {
....
}
}})();
答案 0 :(得分:0)
我希望这可以帮到你;)
<!DOCTYPE html>
<html ng-app="testApp">
<head>
<title>My ParseApp site</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="/Scripts/angular.js"></script>
</head>
<body>
<refresh></refresh>
<script>
angular.module("testApp", [])
.directive("refresh", function () {
return {
restrict: "E",
template: "<button ng-click=\"refreshPage()\">Refresh this page</button>",
link: function (scope, elem) {
scope.refreshPage = function () {
location.reload();
}
}
};
});
</script>
</body>
</html>
答案 1 :(得分:0)