Обновить или обновить рендеринг Json String в AngularJs View - PullRequest
0 голосов
/ 20 сентября 2019

Я пытаюсь загрузить массив объектов json в angularJS.Первый раз, когда нажимаешь на ссылку, работает нормально. Но после обновления / перезагрузки страницы вид исчезает и отображается строка JSON. Может кто-нибудь помочь с решением проблемы?

Контроллер: -

angular.module('app.failureNotify', []).controller('failureNotifyController',
    function($scope, failureNotifyService) {

        failureNotifyService.failureNotify().then(function(response) {
            $scope.failureNotifyResponse = [];
            $scope.failureNotifyResponse = response.data;

        });
    })

HTML: -

<div class="container" ng-controller="failureNotifyController">
<div class="row">
    <div class="col-lg-8">
        <h3>Controller list</h3>
    </div>
</div>
<br /> <br /> <b>From Date</b> : &nbsp;<input type="text" name="from"
    ng-model="from"> <br /> <br /> <b>To Date &nbsp; &nbsp;
    &nbsp; </b>: &nbsp;<input type="text" name="to" ng-model="to"> <br />
<br />
<div class="row">
    <div class="col-lg-8">
        <table>
            <tr>
                <th>Account Number</th>
                <th>Account Type</th>

            </tr>
            <tr
                ng-repeat="failures in failureNotifyResponse">
                <td>{{failures.accountNumber}}</td>
                <td>{{failures.accountType }}</td>

            </tr>
        </table>
    </div>
</div>

Служба: -

angular
    .module('app.services', [])
        .service(
            'failureNotifyService',
            [
                    '$http',
                    function($http) {
                        this.failureNotify = function failureNotify() 
                        {
                            return $http({
                                method : 'GET',
                                url : '/failureNotify',

                            })
                        }
                    } ])

После обновления:

...