ng-init parse syntax error - angularjs

I run this
res.render('NamesPieChart',{ChartLabels : JSON.stringify(["January","February","March","April","May","June"]), DataList : JSON.stringify(datalist), title : "test"});
I can get the datalist with no issues. However, the ChartLabels I get the error:
Syntax Error: Token ',' is an unexpected token at column 47 of the expression [m_datalist=[3,6,2,1,1,2];m_chartlabels=January,February,March,April,May,June] starting at [,February,March,April,May,June].
It is like it doesn't see it as a string.
Any suggestions?

The code that works for me to import ng-init is:
ng-init= "m_datalist=<%-DataList%>;m_chartlabels=<%=ChartLabels%>">

Related

My react app gives an error for some reason

Error:
src\images\navbar.js
Line 2:11: Parsing error: Unexpected token, expected "from" (2:11)
src\navbar.js
Line 2:11: Parsing error: Unexpected token, expected "from" (2:11)
the project on GitHub: https://github.com/PufflyMan/airbnb-exp-clone
It's pretty straightforward code but no matter what I tried, I couldn't fix it. Thanks for attention!
It just fixed itself. I didn't do anything

angular [$parse:ueoe] Unexpected end of expression

I am very new in Angular.. I tried to bind ng-init from the data that I get from ASP.NET codebehind..
The code looks like this:
<div class="ki-component" ng-app ng-init="init(<%= GetSmallCartData(3) %>)">
However I got an error "[$parse:ueoe] Unexpected end of expression". Here is more details
Error: [$parse:ueoe] Unexpected end of expression: init([{
http://errors.angularjs.org/1.6.6/$parse/ueoe?p0=init(%5B%7B
at angular.js:117
at AST.peekToken (angular.js:15278)
at AST.object (angular.js:15219)
at AST.primary (angular.js:15137)
at AST.unary (angular.js:15125)
at AST.multiplicative (angular.js:15112)
at AST.additive (angular.js:15103)
at AST.relational (angular.js:15094)
at AST.equality (angular.js:15085)
at AST.logicalAND (angular.js:15077) "<div class="ki-component ng-scope" ng-app="smallBasket" ng-controller="smallBasketCtrl" ng-init="init([{" _customermaterialnumber":null,"_internallistprizetotal":null,"_prizediscount":null,"_prizeperunit":null,"itemid":null,"mdmaterialnumber":null,"customermaterialnumber":null,"quantity":"1","quantityasked":null,"mddescription":"k="" 7="" premium="" full="" control="" plus="" home="" *eu","mdadditionaldescription":null,"freegood":null,"tdlistprice":null,"netprice":null,"grossprice":null,"requestdatebyuser":null,"deliverableonuserdate":false,"deliverydatebysystem":null,"orderitemschedules":null,"picture":"https:="" d6mbshfzr0ulu.cloudfront.net="" pro="" ad2ede993af5d4cb1dc6da428e12bcc5.jpg","mdweightunit":null,"mdformatedarticleid":"1.317-133.0","mdean":null,"mddimensions":null,"mdpackagesize":null,"mdgrossweight":null,"mdpackageunit":null,"mdpalletsize":null,"mdclassification":null,"mdgrossweightunit":null,"mddangerousgood":false,"mdcompvolume":null,"mdcompvolumeunit":null,"mdvolume":null,"mdvolumeunit":null,"tdcurrencycode":null,"tdstock":null,"tdcountryoforigin":null,"tdhazardclassification":null,"tdunit":null,"conflict":false,"conflicttest":false,"newitem":false,"matchpalletsize":true,"recommendedcountforpallet":0,"shippingpoint":null,"enablearticlenr":false,"enablecustomermatnr":false,"palletquantity":null,"palletsize":null,"palletstackfactor":null}])"="">"
Can anyone help me why I got this error and how I should fix this?
Many Thanks

Error: [ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '\"movie'

I'm trying to test my Rails/Angular app in production Rails server and I'm getting an error in my console I don't know how to fix.
The error is,
Error: [ngRepeat:iexp] Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '\"movie'.
The line of code,
%li.animate-repeat.search_results{"ng-if" => " movie.poster_path && movie.release_date", "ng-repeat" => "movie in movieList | orderBy:'-release_date'"}
The error is resolved when I remove the | orderBy:'-release_date' but obviously that's a filter I need.
Is there a good reason why this error is occuring?
You should check very well , all ng-repeats , specially if you have more than one ng-repeat within your page, I had the same error until I scan through my code carefulyl and found the issue
I read this from Here

Syntax error in order() method using ng-click and ng-repeat

I am using the following html code to create an ng-repeat:
<td ng-repeat="parentCategory in totalParentCategoriesCount | orderBy :'-Count'">
<h3>
Kategori
<span class="sortorder" ng-show="predicate === 'CategoryParent{{parentCategory.Count}}'" ng-class="{reverse:reverse}"></span>
</h3>
</td>
I wish to add the text CategoryParent with the number from parentCategory.Count to create a dynamic link.
When inspecting the link in the browser I get the corret outcome which is CategoryParent0, CategoryParent1, CategoryParent2 and so on. But when clicking the link I get the following error:
Error: [$parse:syntax] http://errors.angularjs.org/1.2.16/$parse/syntax?p0=%7B&p1=is%20an%20unexpe…Parent%7B%7BparentCategory.Count%7D%7D&p4=%7B%7BparentCategory.Count%7D%7D
at Error (native)
at http://localhost:51976/Scripts/angular.min.js:6:450
at $a.throwError (http://localhost:51976/Scripts/angular.min.js:165:141)
at $a.parse (http://localhost:51976/Scripts/angular.min.js:164:6)
at $get (http://localhost:51976/Scripts/angular.min.js:96:122)
at http://localhost:51976/Scripts/angular.min.js:129:290
at http://localhost:51976/Scripts/angular.min.js:10:248
at Array.forEach (native)
at q (http://localhost:51976/Scripts/angular.min.js:7:280)
at Uc (http://localhost:51976/Scripts/angular.min.js:10:219)
On the angular page its says the following:
Syntax Error: Token '{' is an unexpected token at column 15 of the expression [CategoryParent{{parentCategory.Count}}] starting at [{{parentCategory.Count}}].
I have been looking at this answer AngularJS expression throwing a Syntax error in ng-click and therefore tried many different compinations in the order() method but I cant figure out how to make the link dynamic without using brackets.
Right now the parentCategory.Count is an int but I have also tried to parse it to a string but without any success.
ng-click already takes an Angular expression - so no need for the {{}}
ng-click="order('CategoryParent' + parentCategory.Count)"

Parse error while rendering the pdf file in angularjs app

When I try to access the pdf file which is public using the angular-pdf-viewer I got the following error message on console.
Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected token at column 5 of the expression [http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf] starting at [://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf].
here is my pdf directive for rendering the pdf file:
<pdf-viewer delegate-handle="my-pdf-container" url="http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf" scale="1" show-toolbar="true" ></pdf-viewer>
could anyone help on this issue?
all the samples seems to be suggesting define url on scope and reference it. But you may try the following, which stringifys the url
<pdf-viewer delegate-handle="my-pdf-container" url="'http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf'" scale="1" show-toolbar="true" ></pdf-viewer>

Resources