New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
templateUrl doesn't work #14
Comments
I couldn't reproduce this bug. Everything works fine with this configuration: app.js: angular.module('ncy-sample')
.config(function($breadcrumbProvider) {
$breadcrumbProvider.setOptions({
templateUrl: 'breadcrumb.html'
});
}) breadcrumb.html: <table class="table">
<tr ng-repeat="step in steps">
<td>{{step.ncyBreadcrumbLink}}</td>
<td>{{step.ncyBreadcrumbLabel}}</td>
</tr>
</table> Do you have any log in console ? If not, can you give me more elements, like the entire state configuration or ideally, an relevant Plunker or Fiddle ? AngularJS & UI-Router versions that you use can be useful too. Thanks in advance |
Thanks for the wonderful feature. Here is my breadcrumb.tpl.html
Here is the configuration: module.config(function($breadcrumbProvider) {
}); |
Hi and welcome to Github ;) The template file is actually the template of the directive. So the scope used by the template is the scope of the directive.
To debug your problem, please can you change the module.config(function($breadcrumbProvider) {
$breadcrumbProvider.setOptions({
prefixStateName: 'dashboard',
template: '<div>Number of states : {{steps.length}}</div>'
// templateUrl: 'bread/breadcrumb.tpl.html'
});
}); and tell me what happened. If it works, revert the change and copy '<div>Number of states : {{steps.length}}</div>' in your Check also if you have errors in console (press F12). PS: See this page to know how insert code block in Github messages ;) |
Sorry for the delay, here is the plunker with the test case: http://plnkr.co/edit/TbT3nkvUzCvFzAE7gHWi?p=preview If I don't set templateUrl, breadcrumbs are showing on the default page - root.home state. |
Thanks Nicolas.
So, the breadcrumb.tpl.html is linked, but the scope (and thus the steps variable) is not. There were no errors in the console. Thanks again for the quick response. |
It seems we have something serious here. The problem occurs when the Thank to you @aneganov. It's much easier with a Plunker ;) @puttaplay can U confirm you are in the same case? i.e: Is the first-accessed state configured with a |
Nicolas, that's exactly the case with me as well. Thanks for the quick responses. |
If I set my own template via $breadcrumbProvider.setOptions({ templateUrl: ... }) then steps are empty, as $rootScope.$on('$viewContentLoaded', function (event) { .. }) never triggered.
The text was updated successfully, but these errors were encountered: