lal_bosdi
lal_bosdi

Reputation: 173

Call scoped function from outside scope view

I am converting an jQuery based app to angular, which had different modules and controllers for different functionality. Now inside some of these functionality there are some actions that needs a dialog-box.

The dialog-box being used is a div which is appended to the HTML body element on some actions.

I am doing this by placing a div in the base layout which includes angular templates from a rootScope variable.

So if I include a template for changing passwords, the html from the respective template gets loaded to the div which is appended to the body, which is outside the scope of the component controller.

If this template contains a button with click event which needs to call a function inside the controller of a component. How to do this in angular?

Upvotes: 0

Views: 83

Answers (1)

Petr Averyanov
Petr Averyanov

Reputation: 9476

Use modals: http://angular-ui.github.io/bootstrap/

var modalInstance = $modal.open (...);
modalInstance.result.then(function() {/*closed*/}, function() {/*dismissed*/});

For simple dialogs like 'Ok/Cancel', u can put $modal call to service.

Upvotes: 1

Related Questions