2

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

3
  • What's your question? What does "my app is in site/app then js , partials" mean? Commented Feb 27, 2013 at 7:22
  • i mean the all the angular app is inside that folder. that was the folder structure Commented Feb 27, 2013 at 7:58
  • Show us the layout of your project (html, js, anything relevant...). I would think you should remove the first '/' in your template and use something like template: 'partials/test.html' instead, but it boils down to where the template is relative to the html page itself. Commented Feb 27, 2013 at 10:08

2 Answers 2

6

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

2 Comments

Not sure why -1. I'm talking about angularjs template cache system, which allows a template not to be real html file served by a server, but a portion of html code within your html.
Yeah the question is specific to Angular UI Bootstrap and the overriding of these templates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.