0

I have an app AppA which is defined in A.js. It uses ng-route with a template TemplateA; but it has two controllers ControllerA1 (Creating) and ControllerA2 (Editing).

I have an other app AppB which is defined in B.js. It uses some ng-route mechanism with various templates TemplateB1, TemplateB2,... and various controllers ControllerB1, ControllerB2,...

I'm using these apps as following: There is an edit button in AppB. When the user clicks the button, it redirects to a url (containing some id info) and AppA will be run (fetching an ng-resource with given id).

Now I want to make editing with a modal dialog rather than a standalone page. But I want the old mechanism in AppA still running.

What is the appropriate way to move AppA to a modal dialog inside AppB by considering the reusability of Templates and Controllers?

user706071
  • 805
  • 3
  • 10
  • 25

2 Answers2

0

With a little tweaks I guess the below link will help you.

Modal services

Shivaraj
  • 613
  • 3
  • 10
0

Maybe you could do it like this:

1- move A's controllers to a module:

angular.module('moduleA', []);
    .controller('controllerA1', ...)
    .controller('controllerA2', ...)

2- transform the templates from A into directives, in their own module, so that they act as reusable components.

3- Import the module in AppB and use them in your modal.

I am not sure it's the best way, but it should work.

link
  • 1,676
  • 1
  • 13
  • 21