AngularJS $ modal pop-up box instance code, angularjsmodal

Source: Internet
Author: User

AngularJS $ modal pop-up box instance code, angularjsmodal

The following describes how $ modal has a method: open, which describes the attributes of this method:

TemplateUrl: Address of the modal window

Template: used to display html tags

Scope: A content with a scope of modal is used (in fact, $ modal creates a subscope of the current scope). The default value is $ rootScope.

Controller: Initialize $ scope for the controller specified by $ modal. The controller can be injected with $ modalInstance.

Resolve: defines a member and passes it to the Controller specified by $ modal, which is equivalent to a reslove attribute of routes. To pass an objec object, you need to use angular. copy ()

Backdrop: controls the background. Valid values: true (default), false (no background), and "static"-the background exists. However, when you click a button outside the modal window, the modal window is not closed.

Keyboard: whether the modal dialog box is closed when Esc is pressed. The default value is true.

WindowClass: specify a class and add it to the modal window.

The open method returns an instance with the following attributes:

Close (result): close the modal window and pass a result.

Dismiss (reason): undo the modal method and pass a reason

Result: a contract that is passed when the modal window is closed or revoked.

Opened: the variable that is passed when the modal window is opened and the content is loaded.

In addition, $ modalInstance extends two methods: $ close (result) and $ dismiss (reason). These methods can easily close the window without additional controllers.

<! DOCTYPE html> 

The above is the example code of AngularJS $ modal pop-up box introduced by xiaobian. I hope it will help you. If you have any questions, please leave a message and I will reply to you in time. Thank you very much for your support for the help House website!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.