Dinesh Kaushik
Dinesh Kaushik

Reputation: 13

Angular js is controller not loading

I have loaded a page using AngularJS. I have the following code:

var app = angular.module("adhocAnalytical",[]);
app.controller(
        "ReportController",
        function ($scope,$http) {

            $http({
                method: 'POST',
                url: '/campustoolshighered/k12_reports_adhocreport4_analytical_body.do',
                data: 'action=fetchinitdata',
                headers: {'Content-Type': 'application/x-www-form-urlencoded'}
            })
            .success(function(response) {
                $scope.questions = response;
                });
            }
    );

angular.element(document).ready(function (){
    angular.bootstrap(document,['adhocAnalytical']);
});

When we load a page second time in a current session using AngularJS, it does not load. It give only the expression written on the jsp page such as:

{{question.title}}
{{cell.f}}{{cell.f}}
{{row.h}} {{row.v}} {{row.v}}

Upvotes: 0

Views: 197

Answers (1)

Michael
Michael

Reputation: 3326

Remove }; after the success callback:

app.controller(
        "ReportController",
        function ($scope,$http) {

            $http({
                method: 'POST',
                url: '/campustoolshighered/k12_reports_adhocreport4_analytical_body.do',
                data: 'action=fetchinitdata',
                headers: {'Content-Type': 'application/x-www-form-urlencoded'}
            })
            .success(function(response) {
                $scope.questions = response;
                });
            }

    );

Upvotes: 1

Related Questions