Angular Error: $parse:ueoe Unexpected End of Expression with EJS

437 Views Asked by At

I'm getting unexpected End of expression error when I pass nodejs data to to ng-init. I'm confident I'm doing it right however I'm getting the error message above

I call ng-init like so:

<body id="myPage" ng-app="myApp" ng-controller="arrCtrl" ng-init="items = <%- JSON.stringify(myitems) %>">

and the error is here

Unexpected end of expression: items = [{

Thus when I run

{{items}}

It'll display as is.

I also went ahead and declared my module in my script tag just in case like so

    <script>

        var app = angular.module('myApp', []);

        app.controller('arrCtrl', function(){
            console.log("Controller loaded");
        });

    </script>

I looked everywhere and no one seemed to have solved this issue.

0

There are 0 best solutions below