Can I put one controller inside another in html?

Asked

Viewed 89 times

0

let’s assume that my site made in Angularjs has a ng-include from a modal (a floating part of the screen) I can define a controller in this HTML file to control the part that will be included even having a controller before include?

  • Is there any reason to do this? I already think the person exaggerates in most solutions, it seems the exaggeration of exaggeration.

  • Leaving the entire code of a screen inside a single controller is not good for code readability and maintenance. I would prefer each sub-part of a screen to have its own controller, as well as+

  • What is not good for readability is to create a lot of controller. You need this?

1 answer

0

For the specific modal, you can use the angular-ui-bootstrap (https://angular-ui.github.io/bootstrap/#! #modal), where you can call modals with templates and controllers you want.

For other templates, which are common in your application, I suggest creating directives (with your templates and controllers) and these autonomous in your operation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.