5

I am working on a simple application in RhoMobile and I am using AngularJS with it. When defining routeProvider, I have come to the strangest issue I have seen.
I tried many things, like chaning the path for templateUrl defining an explicit one, but with no success. But if I use template property instead of templateUrl it works.

I am getting this error:

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

I am using AngularJS v1.2.16 and I am out of ideas.

EDIT: I set up an example RhoMobile application with angular-seed which has the error, you can find the application here

UPDATE:: I got reply from RhoMobile core developers that this will be fixed in 4.2

TheCodeDestroyer
  • 763
  • 9
  • 29
  • I am not familiar w/ rhomobile, but I just searched your repo for `$sce` and only found references under `public/lib/angular` can you point to where in your code the issue is coming from? – Brocco May 02 '14 at 19:54
  • Its actually comming from angular-route.js for some strange reason when this applications is running with rhomobile the function gets renamed from that the reason why its undefined. This gets called when app config() is going through. – TheCodeDestroyer May 02 '14 at 20:45
  • Please give the community more context. What does your service look like, what does your controller look like? How are you writing it? I can't help you if you don't link an extracted example via plunker or something. Linking an entire app doesn't help. – btm1 May 05 '14 at 15:24
  • Like I said in edit its extracted code from angular-seed(which works out of the box) the main difference is that its in RhoMobile wrapper. – TheCodeDestroyer May 05 '14 at 15:31

3 Answers3

0

It works just fine when served statically, so RhoMobile is probably screwing up the origins, and running your app into CORS issues.

git clone https://github.com/TheCodeDestroyer/rhomobile-angular
cd rhomobile-angular/
python -m SimpleHTTPServer
open "http://localhost:8000/public"
# click around... it works!
chbrown
  • 11,865
  • 2
  • 52
  • 60
  • Like I said in comments as a normal web page it works but with rhomobile combination it sadly does not... – TheCodeDestroyer May 05 '14 at 19:31
  • Regarding origins its actually not screwing the origins. Actually some function of $sce are being renamed in runtime of RhoMobile. Example '$sce.getTrustedResourceUrl()' function is renamed to '$sce.getTrustedResource url()', thats why the error undefined. – TheCodeDestroyer May 06 '14 at 13:42
  • I see. I wasn't able to get RhoMobile running, so I didn't encounter that error. Seems like a RhoMobile bug; I would suggest filing a bug report on their site. – chbrown May 06 '14 at 17:10
  • I actually created a support ticket as well, but tried to cover as many resources as possible including SO. As I needed this issue resolved asap... Now I have temp fix adjusting angular code, but i really dont like that... – TheCodeDestroyer May 08 '14 at 13:04
0

Indeed, issue has no any relation to rhomobile code. Rhomobile used opal.rb/opal.js conflicted with angular.js until RMS4.2. Started from RMS4.2 opal.js is not in use anymore. So there may be another reason for your issue.

In case you run your application using RhoSimulator on windows it may be a bug with toLowerCase() method of String class. It looks like the bug is in the QTWebView component used for RhoSimulator. Just discovered it and fix is in the progress. Issue appears only on windows. On Mac OS X everything performing correctly.

Try to evaluate following expression in web console of RhoSimulator: "RESOURCE_URL".toLowerCase()

In case it evaluates as "resource url" the angular.js will not work.

Watch for update in your RhoMobile support ticket.

dipspb
  • 1
  • 1
-1

It doesn't look like you're including the ngSanitize module.

matthoiland
  • 912
  • 11
  • 24