user192362127
user192362127

Reputation: 11635

How can I use templates in Angular UI bootstrap dialogs?

I am using the Angular UI bootstrap module for opening a dialog.

There is a option for mentioning the path of template like

$scope.opts = {
            backdrop: true,
            keyboard: true,
            backdropClick: true,
            template: '<p>Template</p>',
            controller: 'TestDialogController'
          }

my app is in site/app then js , partials

I am not able to find how it finds templates

Upvotes: 2

Views: 4547

Answers (2)

Pipetus
Pipetus

Reputation: 1136

There's a use of <script> as a directive which would allow you to make a hybrid approach.

Angular docs mention that if you use a declaration in your html like:

<script type="text/ng-template" id="/tpl.html">
  Content of the template.
</script>

Then you can use it as a reference in a directive such as ngInclude or ngView, and even a service like $route. You can see this working in this fiddle.

Upvotes: 1

Kenneth Lynne
Kenneth Lynne

Reputation: 15579

The Angular UI bootstrap dialog takes either a template inline,

template: '<p>This is a inline template</p>';

or the template url can be specified as both a relative and absolute path.

templateUrl: '/relative/path/dialog.html';

Try to open a browser tab pointing to your template first, and when you successfully have derived the path you can try to add it to your templateUrl.

You can read more about correct usage of the directive here.

Upvotes: 6

Related Questions