Infinite loop between JSP and webpack + AngularJS app - angularjs

We are trying to integrate a JEE app (jsp on the frontend) with an angularJs app. The angularJS is being packaged with webpack so in the jsp we are linking the app thru a <script> tag
The application is being manually bootstrapped once the modules are already defined.
The result once the manual bootstrapping occurs is kind of an infinite loop between the jsp and the angular app. We can see the url alternating between these two:
http://localhost:8080/app/initApplication?lang=ES&TOTAL_APPROVALS=1#_
http://localhost:8080/app/initApplication?lang=ES&TOTAL_APPROVALS=1#/
Note the / at the end of the second one.
The angular app sometimes get rendered in the browser and some others don't.
We think it has something to do with what occurs with $location when manually bootstrapping an Angular app but we really don't know.
What's going on?

Related

Where to put ng1 templates in an angular hybrid application built by angular-cli?

I'm trying to build an angular hybrid application out of a angular.js application. I'm following the official documentation (https://angular.io/guide/upgrade). I reached and completed this step: https://angular.io/guide/upgrade#bootstrapping-hybrid-applications.
I'm using angular ui-router 0.3.1 to handle the routing of my application. Therefore, using the config function on my main module, and the $stateProvider service, I've mapped each route to an angular.js controller and a template specified by the templateUrl parameter.
My application seems to startup correctly but the templates cannot be loaded because they cannot be found (404 error). This is normal because they are not imported in the dist folder where my application is built when I use the ng build angular-cli command line.
How can I configure my application so that my angular.js html templates get copied in the dist folder when my angluar application is built by angular-cli?
Thanks in advance!
So actually it appears my question was a duplicate of that one: Angular CLI with Hybrid app ng-build.
The idea is to use the assets array from angular-cli.json. Glob enables to select recursively all html files from the folder of your choice and to put them in a subfolder of dist:
"asssets": [{"glob": "**/*.html", "input": "../src-ng1", "output": "./src-ng1"}]

How to use ui-router in nw js

I am build desktop application using nw js with angular js, I want to use ui-router for routing. I have written function handlers for api call I dont want http request. when I start application with nw js only index.html is loading template urls are not loading. I found application working with ngRoutes but I want to include states in my routes. How to do this?

Angularjs how to loads required js files home page index.html

We have angularjs app with lot of js getting loaded during the initial page load. Which are not required as part of home page. How we can void these. Is requieedjs solve this. How and when other js files get loads.
requirejs can be troublesome to use with angular
use following:
https://oclazyload.readme.io/docs

Using HTML instead of ejs in sails

I am a newbie on sails framework and I started working on it then found that everything is in ejs. When I converted it into the HTML then it didn't work.
How to write client-side in HTML using AngularJS without ejs or with least ejs possible if we cannot remove it totally.
Where to write client-side routes and how to use ui-router in that?
You should place your angular code in assets/js. The html files are also to be placed in assets folder.
I have set up a basic sails/ angular app in github. Angular Demo

How to test your sinatra app's javascript with jasmine?

I'm having an hard time setting up jasmine to load my javascripts from my sinatra app. Basically I'm using the asset-pipeline (yes, I have it in the sinatra app in dev), and using angular. Ideally I could let the app run somewhere in a port while I would apply my tests directly, as getting fixtures in such an interactive app will make my eyes rain.
So, bottom line: how can I make jasmine load an asset-pipelined non-rails app?

Resources