0

I had an application made previously on angular 1.3, which had some dependencies then. The structure is:

<script>.....angular1.3</script><html ng-app="myprevapp">......</html> 

Now i have a new app

<script>.....angular1.4</script><html ng-app="mynewapp">......</html> 

Now what i want is to use my previous app as a widget in my new app.How to achieve this?

I have some libraries in "myprevapp" which runs fine for angular1.3 fine,i don't have much of a time to migrate it to 1.4 and test it.

I want to lessen the development efforts. Please advice some judicious way.

Thanks in advance!

1 Answers1

0

Great question - In the HTML you'd need to change where the angular 1.3 app starts and have the 1.4 app take the lead:

<html ng-app="mynewapp">
   <!-- CSS & JSS loading -->
   <body>
       <div id="myprevapp">
       </div>
   </body>
</html>

Here we can see that the previous app will now live inside the new one - you can only have one ng-app signature in a single applicaiton. Then you'll have to manually bootstrap the app/s into this one.

angular.
  bootstrap(document.getElementById("myprevapp"), ['myprevapp']);

A more in-depth answer can be found here

Community
  • 1
  • 1
Katana24
  • 8,706
  • 19
  • 76
  • 118