Last active
December 21, 2015 08:19
-
-
Save langhard/6277825 to your computer and use it in GitHub Desktop.
AngularJS (1.1.5) - Directives - Dynamic Template URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
angular.module('clientApp') | |
.directive('formFields', function () { | |
return { | |
templateUrl: function (tElement, tAttrs) { | |
return tAttrs.templateUrl; | |
}, | |
restrict: 'E' | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ng-form name="new-info" ng-init="newInfo"> | |
<form-fields template-url="views/partials/model/info/form.html"></form-fields> | |
<input type="submit" ng-click="apiPost(info)"/> | |
</ng-form> |
Just what I was looking for, many thanks!
I just don't undestand...
- your templateUrl is not dynamic, it's hardcoded in your html template.
- don't you are re-coding ng-include in fact ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks Thanks Thank Thanks!!!!