问题
Originally, I had asked why the partial that I've defined in my controller and ng-template won't populate the modal.
After having no success loading any directive on the script tag - I believe that the routing method we are using is what is circumventing the script from finding the partial.
The directive's templateUrl returns 404 when invoked via the modal ng-click="open()". Everything resolves correctly if invoked on other elements.
Directive loads templateUrl on div:
<div data-modal-partial-directive></div>
Directive templateUrl returns 404 on script:
<div ng-controller="ModalDemoCtrl">
<script type="text/ng-template"
data-modal-partial-directive>
</script>
<button class="button" ng-click="open()">Open me!</button>
</div>
What's even more confounding is that the controller logs that the modal was dismissed. Which means that everything else is running smoothly, except that 404 stops the content from loading, which closes the modal.
Does this sound familiar to anyone's use case? Is there a way around it?
来源:https://stackoverflow.com/questions/27629290/angular-directive-templateurl-wont-render-on-script-tag