Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
AngularJS UI路由器加载的页面控件不';不重新加载页面就无法工作_Angularjs_Angular Ui Router - Fatal编程技术网

AngularJS UI路由器加载的页面控件不';不重新加载页面就无法工作

AngularJS UI路由器加载的页面控件不';不重新加载页面就无法工作,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我正在使用路由。 当我使用以下代码加载.html页面时: $stateProvider.state("admin.cabletv.all-invoice", { url: "/all-invoice", templateUrl: "app/invoice/invoice-list.html", params: { 'type': '1' }, cache: false }); 发

我正在使用路由。 当我使用以下代码加载.html页面时:

  $stateProvider.state("admin.cabletv.all-invoice", {
        url: "/all-invoice",
        templateUrl: "app/invoice/invoice-list.html",
        params: {
            'type': '1'
        },
        cache: false
    });
发票列表.html

<div class="panel panel-primary" ng-controller="pqsInvoiceListController as model">
<div class="panel-heading">
    <div class="row">
        <div class="col-sm-2">{{model.pageTitle}}</div>
        <div class="col-sm-2 col-sm-offset-8">
            <button class="btn btn-default" ng-click="model.printInvoice()">Print</button>
        </div>
    </div>
</div>
<div class="panel-body">
    <div style="overflow-x: auto">
        <table class="table table-bordered">
            <thead>
            <tr>
                <th><input type="checkbox" ng-model="model.selectedAll" ng-change="model.checkAll()" autocomplete="off" /></th>
                <th>In.&nbsp;no</th>
                <th>Type</th>
                <th>Client</th>
                <th>Client&nbsp;Id</th>
                <th>Mobile&nbsp;No</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="invoice in model.invoices">
                <td><input type="checkbox" ng-model="model.idList[invoice.id].isSelected"/></td>
                <td>{{invoice.id}}</td>
                <td>{{invoice.invoiceType | pqsInvoiceType}}</td>
                <td>{{invoice.connection.client.name}}</td>
                <td>{{invoice.connection.client.id}}</td>
                <td>{{invoice.connection.client.mobileNumber1}}</td>
            </tr>
            <tr ng-if="model.invoices.length">
                <td colspan="12">Total</td>
                <td>{{model.totalAmount}}</td>
                <td colspan="4"></td>
            </tr>
            </tbody>
        </table>
    </div>        
</div>

已加载invoice-list.html页面,但此页面中的控件(复选框)不起作用。当我点击复选框时,它不工作。若我使用F5重新加载页面,那个么它可以正常工作。如何在不重新加载页面的情况下解决此问题。

可以显示控制器代码吗?为什么不在状态下定义控制器,如:JS$stateProvider.state(“admin.cabletv.all invoice”),{url:/all invoice”,控制器:pqsInvoiceListController,控制器:model,模板url:“app/invoice/invoice list.html”,参数:{'type':'1'},缓存:false});HTML。。。。。。。。。。如果我重新加载页面,所有的工作都正常。但第一次它不起作用。我认为控制器在这里没有任何问题。主要问题发生在加载invoice-list.html时。在第一次加载中,即使鼠标右键也不起作用。
(function (module) {

    var pqsInvoiceListController = function () {
        var vm = this;


        vm.idList = {};
        var buildIdList = function(invoices) {
            angular.forEach(invoices, function (invoice) {
                vm.idList[invoice.id] = {isSelected : false};
            });
        };

        vm.checkAll = function () {

            vm.selectedAll = !!vm.selectedAll;

            angular.forEach(vm.idList, function (id) {
                id.isSelected = vm.selectedAll;
            });
        };

    };

    module.controller("pqsInvoiceListController", pqsInvoiceListController);

}(angular.module("pqs.ui")));