noeticpenguin / AngularVisualforceSeed

This project is a "seed" project for using Angular 1.3 on Salesforce.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ngForce vfr error

Nick-Propertybase opened this issue · comments

After installing the unmanaged package, and running through some proof of concept work, I ran into an issue when calling the pre-defined vfr method below, and I noticed that ngForce(ngForce-visualForceRemoting.js) source was out of date compared to your ngForce repo. I tried other vfr methods including calling the controller directly with .send(), but the results were the same.

vfr method - Errors is created by the first line in the snippet.

var propType = vfr.describePicklistValues('pba__Listing__c', 'pba__PropertyType__c');
propType.then(function(results){
    $scope.propertyType = results;
});

Before attempting to update static resources with the new version of ngForce, I would get the following error:

Uncaught TypeError: undefined is not a functionngForce-visualForceRemoting.js:93 (anonymous function)VFRemote.js:132 e.cbVFRemote.js:99 VFExt3.direct.RemotingProvider.VFExt3.extend.doCallbackVFRemote.js:94 VFExt3.direct.RemotingProvider.VFExt3.extend.onDataVFRemote.js:75 VFExt3.extend.handleResponseVFRemote.js:39 aVFRemote.js:40 (anonymous function)

After updating ngForce(ngForce-visualForceRemoting.js) manually I get the following error:

 Uncaught SyntaxError: Unexpected token &

Thanks for putting together/sharing the seed and ngForce projects. They are both a huge help to get going with angularJs and SF in structured manor.

Yeah, I need to update the vfr seed project to the newest ngforce. 

With an 8mth old who’s sick, the holidaze and the strong likely hood that i’ll catch whatever baby coder has… well, feel free to send a pull request.

-Kevin

-- 
Kevin Poorman
Sent with Airmail

On December 12, 2014 at 3:13:56 PM, Nick-Propertybase (notifications@github.com) wrote:

After installing the unmanaged package, and running through some proof of concept work, I ran into an issue when calling the pre-defined vfr method below, and I noticed that ngForce(ngForce-visualForceRemoting.js) source was out of date compared to your ngForce repo. I tried other vfr methods including calling the controller directly with .send(), but the results were the same.

vfr method - Errors is created by the first line in the snippet.

var propType = vfr.describePicklistValues('pba__Listing__c', 'pba__PropertyType__c');
propType.then(function(results){
$scope.propertyType = results;
});
Before attempting to update static resources with the new version of ngForce, I would get the following error:

Uncaught TypeError: undefined is not a functionngForce-visualForceRemoting.js:93 (anonymous function)VFRemote.js:132 e.cbVFRemote.js:99 VFExt3.direct.RemotingProvider.VFExt3.extend.doCallbackVFRemote.js:94 VFExt3.direct.RemotingProvider.VFExt3.extend.onDataVFRemote.js:75 VFExt3.extend.handleResponseVFRemote.js:39 aVFRemote.js:40 (anonymous function)

After updating ngForce(ngForce-visualForceRemoting.js) manually I get the following error:

Uncaught SyntaxError: Unexpected token &

Thanks for putting together/sharing the seed and ngForce projects. They are both a huge help to get going with angularJs and SF in structured manor.


Reply to this email directly or view it on GitHub.

Completely understandable.

I update it locally, but I am still getting that last error.

Uncaught SyntaxError: Unexpected token &

Any insight on what would be causing that?

Thanks,
Nick

On Fri, Dec 12, 2014 at 1:16 PM, Kevin Poorman notifications@github.com
wrote:

Yeah, I need to update the vfr seed project to the newest ngforce.

With an 8mth old who’s sick, the holidaze and the strong likely hood that
i’ll catch whatever baby coder has… well, feel free to send a pull request.

-Kevin

Kevin Poorman
Sent with Airmail

On December 12, 2014 at 3:13:56 PM, Nick-Propertybase (
notifications@github.com) wrote:

After installing the unmanaged package, and running through some proof of
concept work, I ran into an issue when calling the pre-defined vfr method
below, and I noticed that ngForce(ngForce-visualForceRemoting.js) source
was out of date compared to your ngForce repo. I tried other vfr methods
including calling the controller directly with .send(), but the results
were the same.

vfr method - Errors is created by the first line in the snippet.

var propType = vfr.describePicklistValues('pba__Listing__c',
'pba__PropertyType__c');
propType.then(function(results){
$scope.propertyType = results;
});
Before attempting to update static resources with the new version of
ngForce, I would get the following error:

Uncaught TypeError: undefined is not a
functionngForce-visualForceRemoting.js:93 (anonymous
function)VFRemote.js:132 e.cbVFRemote.js:99
VFExt3.direct.RemotingProvider.VFExt3.extend.doCallbackVFRemote.js:94
VFExt3.direct.RemotingProvider.VFExt3.extend.onDataVFRemote.js:75
VFExt3.extend.handleResponseVFRemote.js:39 aVFRemote.js:40 (anonymous
function)

After updating ngForce(ngForce-visualForceRemoting.js) manually I get the
following error:

Uncaught SyntaxError: Unexpected token &

Thanks for putting together/sharing the seed and ngForce projects. They
are both a huge help to get going with angularJs and SF in structured
manor.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#1 (comment)
.

Can you post example code so I can play with it?

-- 
Kevin Poorman
Sent with Airmail

On December 12, 2014 at 3:42:09 PM, Nick-Propertybase (notifications@github.com) wrote:

Completely understandable.

I update it locally, but I am still getting that last error.

Uncaught SyntaxError: Unexpected token &

Any insight on what would be causing that?

Thanks,
Nick

On Fri, Dec 12, 2014 at 1:16 PM, Kevin Poorman notifications@github.com
wrote:

Yeah, I need to update the vfr seed project to the newest ngforce.

With an 8mth old who’s sick, the holidaze and the strong likely hood that
i’ll catch whatever baby coder has… well, feel free to send a pull request.

-Kevin

Kevin Poorman
Sent with Airmail

On December 12, 2014 at 3:13:56 PM, Nick-Propertybase (
notifications@github.com) wrote:

After installing the unmanaged package, and running through some proof of
concept work, I ran into an issue when calling the pre-defined vfr method
below, and I noticed that ngForce(ngForce-visualForceRemoting.js) source
was out of date compared to your ngForce repo. I tried other vfr methods
including calling the controller directly with .send(), but the results
were the same.

vfr method - Errors is created by the first line in the snippet.

var propType = vfr.describePicklistValues('pba__Listing__c',
'pba__PropertyType__c');
propType.then(function(results){
$scope.propertyType = results;
});
Before attempting to update static resources with the new version of
ngForce, I would get the following error:

Uncaught TypeError: undefined is not a
functionngForce-visualForceRemoting.js:93 (anonymous
function)VFRemote.js:132 e.cbVFRemote.js:99
VFExt3.direct.RemotingProvider.VFExt3.extend.doCallbackVFRemote.js:94
VFExt3.direct.RemotingProvider.VFExt3.extend.onDataVFRemote.js:75
VFExt3.extend.handleResponseVFRemote.js:39 aVFRemote.js:40 (anonymous
function)

After updating ngForce(ngForce-visualForceRemoting.js) manually I get the
following error:

Uncaught SyntaxError: Unexpected token &

Thanks for putting together/sharing the seed and ngForce projects. They
are both a huge help to get going with angularJs and SF in structured
manor.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#1 (comment)
.


Reply to this email directly or view it on GitHub.

Hi Kevin,

Apologies for the delay. I have traced the error back to line #112 on 'ngForce-visualForceRemoting.js'

#112:

result = JSON.parse(result);

Looking at the Network response in chrome, I show valid JSON data being sent back from 'apexremoting', but when I would 'console.log(result);' prior to line#112 the data would come back with all of the double quotes converted to html("), which is causing my original error.

Network - apexremote - response:

[{"statusCode":200,"type":"rpc","tid":2,"ref":false,"action":"ngForceController","method":"getPicklistValues","result":"[{\"value\":\"Mr.\",\"label\":\"Mr.\"},{\"value\":\"Ms.\",\"label\":\"Ms.\"},{\"value\":\"Mrs.\",\"label\":\"Mrs.\"}]"}]

Added to line 111# - console.log(result):

 [{"value":"Mr.","label":"Mr."},{"value":"Ms.","label":"Ms."},{"value":"Mrs.","label":"Mrs."}]

 seedApp:1 Uncaught SyntaxError: Unexpected token &

I have been able to fix the error by adding in a simple .replace method shown below, but I was hoping you could help me identify what I am missing. I have confirmed all resources are loaded via the python server.

Current fix that replaces line#112:

result = JSON.parse(result.replace(/"/g,'"'));

If you still need me to post the code, I will upload the project right away.

Thanks,
Nick