Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/70.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
Html 点击按钮angularjs刷新div_Html_Angularjs_Refresh - Fatal编程技术网

Html 点击按钮angularjs刷新div

Html 点击按钮angularjs刷新div,html,angularjs,refresh,Html,Angularjs,Refresh,我尝试在成功时加载div内容,而不是在返回$http服务时刷新整个页面,如下所示 单击表单中的“保存”按钮后,应更新我的div仪表板内容列表 我做错了什么 Html 单击表单中的“保存”按钮后,应更新我的div仪表板内容列表 <div class="modified-list block-list col-sm-12" id="dashBoardContents" ng-init="getDashBoardDatatoPopulate()"> <p cl

我尝试在成功时加载div内容,而不是在返回$http服务时刷新整个页面,如下所示

单击表单中的“保存”按钮后,应更新我的div仪表板内容列表 我做错了什么

Html 单击表单中的“保存”按钮后,应更新我的div仪表板内容列表

    <div class="modified-list block-list col-sm-12" id="dashBoardContents" ng-init="getDashBoardDatatoPopulate()">
        <p class="text-center" ng-hide="dashBoardDataLoaded">
            <i class="fa fa-spinner fa-spin"> </i>
        </p>
        <p class="redirection-head" ng-if="dashboardDataCount!=0 && dashBoardDataLoaded">Your last {{dashboardDataCount}} modified</p>
        <p class="redirection-head" ng-if="dashboardDataCount==0">There is no modification by you recently</p>
        <ul class="redirection-list clearfix" >
            <li class="redirection clearfix" ng-show="dashBoardDataLoaded" ng-repeat="list in getDashBoardData" ng-click="ResetOnClose();GetEditFormData(list.fromUrl,list.Markets);getRequest();ShowEditRedirect($event);">
                <a href="">
                    <div class="redirection-url col-md-6 col-sm-6">
                        <div class="from-url">
                            <span title={{list.fromUrl}}>{{list.fromUrl}}</span>
                        </div>
                        <div class="to-url">
                            <span title={{list.toUrl}}>{{list.toUrl}}</span>
                        </div>
                        <div class="redirection-status-list clearfix">
                            <div ng-class="{active: list.redirectionStatusQA ==='Enabled','out-of-sync': list.redirectionStatusQA ==='Disabled'}" class="redirection-status status-qa ">
                                <span>QA</span>
                                <span>{{list.redirectionStatusQA}}</span>
                            </div>
                            <div ng-class="{active: list.Published ==='Yes',inactive: list.Published ==='No'}" class="redirection-status status-qa">
                                <span>Published</span>
                                <span>{{list.Published}}</span>
                            </div>
                            <div ng-class="{active: list.redirectionStatusLive ==='Enabled',inactive: list.redirectionStatusLive ==='Disabled',disabled: list.redirectionStatusLive ==='NotLive'}" class="redirection-status status-qa">
                                <span>Live</span>
                                <span>{{list.redirectionStatusLive}}</span>
                            </div>
                            <div class="redirection-status status-live pull-right" ng-hide="true">
                                <div class="redirection-status-Stats">Stats</div>
                            </div>
                        </div>
                    </div>
                    <div class="redirection-details col-md-6 col-sm-6">
                        <ul>
                            <li class="clearfix">
                                <span>Markets</span>
                                <div class="redirection-detailsDiv">
                                    <span style="float:right" ng-repeat="market in list.Markets">{{market}}</span>
                                </div>
                            </li>
                        </ul>
                    </div>
                </a>
            </li>
        </ul>
    </div>
    <form name="form" novalidate>
        <div class="redirection-edit redirection-editD col-sm-6 stickem">
            <div class="redirection-edit-form">
                <div class="redirection-edit-header">
                    <button type="button" id="modifyButton" class="btn btn-default create" ng-click="Submitted=true && SendData(formData,redirectionType,false);">Save</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </form>

您可以在成功时使用
ng show
ng if



范围
$scope.getDashBoardDatatoPopulate()中有返回数据

我认为您不需要使用JQuery来刷新数据,push-in-array()将按如下方式刷新数据:

$scope.getDashBoardData = [];
$scoppe.getData = {
  data: {},
  success: false 
};

$scope.SendData = function (Data, redirection_type, IsPublish) {

       $http({
            url: $rootScope.host + "/TeleportWebApi/api/Edit/UpdateRedirects",
            dataType: 'json',
            method: 'PUT',
            data: GetAll,
            headers: {
                "Content-Type": "application/json"
            }
        }).then(function (response) {
            alert("Modified Succesfully!");
            $scope.isEditable = false;
            if (response.data) {
              $scope.getData.data = response.data;
              $scope.getData.success = true;
            }
            $scope.getDashBoardData.push({$scope.getData.data});
            $scope.modifiedSuccess = response.data;
            $scope.fromUrl = GetAll.DestinationURL;
            $scope.getDashBoardDatatoPopulate();
        })
         .catch(function (response) {
            window.alert("Modification Unsuccessful!");
               // window.location.reload(true);
            console.error("Failed to Modify Data " + response.status + response.statusText);
         })
}

这就像更新一个div中的项目之后,另一个div应该更新。当我刷新整个页面时,它会更新,但我希望#dashBoardContents div在成功调用后得到刷新。您可以输入有关代码的更多信息以了解您的问题。。。您的html代码和angularJS@user9326447没关系?
$scope.success = false;

$http(...)
.then(function (response) {
if (response) {
  $scope.success = true;
}
  alert("Modified Succesfully!");
};
<div id="dashBoardContents" ng-show="success"> </div>
$scope.getDashBoardData = [];
$scoppe.getData = {
  data: {},
  success: false 
};

$scope.SendData = function (Data, redirection_type, IsPublish) {

       $http({
            url: $rootScope.host + "/TeleportWebApi/api/Edit/UpdateRedirects",
            dataType: 'json',
            method: 'PUT',
            data: GetAll,
            headers: {
                "Content-Type": "application/json"
            }
        }).then(function (response) {
            alert("Modified Succesfully!");
            $scope.isEditable = false;
            if (response.data) {
              $scope.getData.data = response.data;
              $scope.getData.success = true;
            }
            $scope.getDashBoardData.push({$scope.getData.data});
            $scope.modifiedSuccess = response.data;
            $scope.fromUrl = GetAll.DestinationURL;
            $scope.getDashBoardDatatoPopulate();
        })
         .catch(function (response) {
            window.alert("Modification Unsuccessful!");
               // window.location.reload(true);
            console.error("Failed to Modify Data " + response.status + response.statusText);
         })
}