AngularJS url template resource issue

// Expert user has replied.
N Nace Logar 3 years 6 months ago
8 4 0

Hi I have a weird error using AngularJS routeProvider when certain route is being processed
I get an error when its trying to resolve templateUrl in RhoSimulator console:

'undefined' is not a function (evaluating '$sce.getTrustedResourceUrl(templateUrl)')

If I define a template directly instead of templateUrl it works, but I really don't want to have 3m long sausage strings.
I tried as a pure Angular app and it works, but in synergy with RhoMobile this does not work,
although I haven't tried in Android simulator or on pure device.
I tried using different url paths to templates, but nothing does it, I'm really out of ideas here.
So I would really appreciate some help...

I am using AngularJS 1.2.16 and RhoMobile 4.1.

EDIT: Ok I tested this with android emulator and my real device still the same issue...

Please Register or Login to post a reply

4 Replies

N Nace Logar

OK I got feedback from support that this will be fixed in 4.2

N Nace Logar

Ok I dug a bit deeper and I noticed that something weird happens and I presume it has to do with RhoMobile.
Function from $sceProvider is undefined because it is named "getTrustedResource url()" instead of "getTrustedResourceUrl()",
so I think the framework changes its name and that is why it says its undefined. For now I commented this line of code out of angular-route.js
as this only check if the path of the template is trusted and since I will always be using it from localhost I know it is trusted and I don't need that check.
This is also not the only function that is renamed in $sceProvider, so I hope I won't stumble upon some other angular function being renamed,
hopefully you find out why this is happening and fix it in the new version.

P Pietro Francesco Maggi

Hi Nace,
that's strange.
Looking at your sample app, you left start_path="/app" in Config.txt.

Could be valuable doing a test making a JavaScript only application.
You can setup start_path="/public" and put in the public folder a standard index.html, just remember to load the RhoMobile JavaScript module before any other JS file.

More informations are available on the documentation site:
Rhomobile | Using RhoMobile JavaScript API's

~Pietro

P Pietro Francesco Maggi

Hi Nace,
can you log the value of templateURL before this call using an "alert"?

Can you paste here the syntax that work for you (the 3m sausage :-)

~Pietro

CONTACT
Can’t find what you’re looking for?