Angular js - 应用程序/控制器在移动到选项卡后无法正常工作

时间:2018-03-16 12:56:34

标签: javascript angularjs

Angular.js新手。我整合了多个aspx页面,每个页面都有一个用户控件到一个aspx页面,将用户控件移动到选项卡。每个用户控件使用angular.js打开并填充模态窗口。模态弹出窗口不再有效,而是发生回发。

如果我将它移到它所适用的<div class="wb-tabs">部分之外,那么它就不会。

HTML

<div class="wb-tabs">
    <div class="tabpanels">
        <details id="Details1" open="open" runat="server">
            <summary>Test Popups</summary>
                <div data-ng-app="positionDataPopupApp">
                    <div data-ng-controller="PositionDataController">
                        <uc2:summary ID="summaryTest" runat="server" />
                            <section id="posnoModal">
                                <%--Modal code removed for brevity--%>
                            </section>
                    </div>
                </div>
        </details>
    </div>
</div>

的JavaScript

var positionDataPopupApp = angular.module('positionDataPopupApp', [])
.controller('PositionDataController', function ($scope, $http) {    

    $scope.getData = function (positionNumber, orgCode) {
        var paramData = { "OrganizationCode": orgCode, "PositionNumber": positionNumber, "Language": lang };
        var url = positionDataLookupPageUrl + '/GetPositionDetails';

        $http.post(url, paramData)
        .success(function (data, status, headers, config) {
            $scope.positionDetails = data.d;
            console.log($scope.positionDetails);
        })
        .error(function (data, status, headers, config) {
            console.log("failed -- ", status); alert(status);
        });

        url = positionDataLookupPageUrl + '/GetCoordinateDegreeDetails';
        $http.post(url, paramData)
      .success(function (data, status, headers, config) {
          $scope.coordinateDegrees = data.d;
          console.log($scope.coordinateDegrees);
          var points;
          var totalPoints = 0;
          for (i = 0; i < $scope.coordinateDegrees.length; i++) {
              points = parseInt($scope.coordinateDegrees[i].Coordinate_Degree_Points) || 0;
              totalPoints = totalPoints + points;
          }
          $scope.totalPoints = totalPoints;
          wb.doc.trigger("open.wb-lbx", [[{ src: "#posnoModal", type: "inline" }], true]);
      })
      .error(function (data, status, headers, config) {
          console.log("failed -- ", status); alert(status);
      });
    };
});

0 个答案:

没有答案