I'm getting an angularjs error in my firebug console from JSON echo'd out 
with PHP.  Even when I strip out ALL references to angularjs, that PHP file 
STILL gives me the same error.  I'm guessing that angularjs is somehow 
monitoring anything that looks like JSON data, and trying to parse it?  I 
don't know.  This is the error:

Error: [$parse:syntax] http://errors.angularjs.org/1.2.12/$parse/syntax? etc., 
etc.


If I comment out the PHP echo statement, the error goes away.  The error 
stops execution of my code, and it took me a long time to isolate the line 
of code that was causing the error.  The other really strange thing, is 
that if I ECHO out some BAD JSON, I don't get an error.  If I echo some 
corrected JSON, I get an error.

If this is echo'd out with PHP, I get NO error.  This has no matching 
bracket on the end.

*All store Listings: {{"0" : {"ad":"Rocker","ac":51,"af":"4","ah":"IP 
Holder","ab":"UnKnown","ae":"Wooden Rocking Chair","ag":"Looks 
Good","aa":"D14169LkGmw"},{"1" : 
{"ad":"Car","ac":26900,"al":"jpg","af":"5","ai":"jpg","ah":"IP 
Holder","ab":"Toyota","ak":"jpg","meet":"Atlanta","ae":"2013 Toyota Camry 
Hybrid Sedan","ag":"Mint Looks","aa":"E320141119PW93","aj":"jpg"},{"2" : 
{"ad":"Rocker","ac":50,"af":"5","ah":"IP 
Holder","ab":"Unknown","ae":"Wooden rocking chair.","ag":"Looks 
Good","aa":"D14169LkGmw"},{"3" : 
{"ad":"Car","ac":23000,"al":"jpg","af":"5","ai":"jpg","ah":"IP 
Holder","ab":"Subaru","ak":"jpg","meet":"**Detroit","ae":"2013 Subaru 
Impreza Hatchback","ag":"Mint Looks","aa":"E3201412UeR90","aj":"jpg"}*

If this is echo'd out with PHP, I get the error, and my code gets killed.

*All store Listings: {{"0" : {"ad":"Rocker","ac":51,"af":"4","ah":"IP 
Holder","ab":"UnKnown","ae":"Wooden Rocking Chair","ag":"Looks 
Good","aa":"D14169LkGmw"},{"1" : 
{"ad":"Car","ac":26900,"al":"jpg","af":"5","ai":"jpg","ah":"IP 
Holder","ab":"Toyota","ak":"jpg","meet":"**Atlanta","ae":"2013 Toyota Camry 
Hybrid Sedan","ag":"Mint Looks","aa":"E320141119PW93","aj":"jpg"},{"2" : 
{"ad":"Rocker","ac":50,"af":"5","ah":"IP 
Holder","ab":"Unknown","ae":"Wooden rocking chair.","ag":"Looks 
Good","aa":"D14169LkGmw"},{"3" : 
{"ad":"Car","ac":23000,"al":"jpg","af":"5","ai":"jpg","ah":"IP 
Holder","ab":"Subaru","ak":"jpg","meet":"Detroit","ae":"2013 Subaru Impreza 
Hatchback","ag":"Mint Looks","aa":"E3201412UeR90","aj":"jpg"}}*

I'm concatenating arrays together as a string to create a multidimensional 
array.

        if (strlen($oneStoreListing) > 1) {
          //Keep adding single store listings to the array until the loop 
is done.
          $storeListingsData = $storeListingsData . trim($oneStoreListing) 
. ",";
          echo "<br>";
          var_dump($storeListingsData);
          echo "<br>";
        }

Then when the loop is finished, I remove the unneeded comma at the end and 
replace it with a second curly brace.

      $storeListingsData = substr($storeListingsData,0,-1);
      $storeListingsData = $storeListingsData . "}";

Is angularjs searching and parsing anything that looks like JSON as soon as 
the page is loaded?  That's what it seems like.  I'll try creating the JSON 
some other way, other than by concatenating text, and see if that makes a 
difference.  But, in any case, finding the cause of this error was a real 
pain.  It seems like a bug to me.

I just updated to angular.min.js 1.2.16 and I'm getting the same error.

Error: [$parse:syntax] http://errors.angularjs.org/1.2.16/$parse/syntax?


-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to