1. add below line of code in app.js file
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
app.directive('myDirective', function () {// used for custom directive for used same html for anywhere. return { restrict: 'AE', templateUrl: function (ele, attrs) { return attrs.templatePath; }, link: function (scope, el) { //we dont need below if condition. if (scope.productForm != undefined) { scope.$parent.productForm = scope.productForm; // when ever we create directive, then child scope is created for html inside directive/common file html. that why we will use $parent. } } }; }); |
2. here is out html.
1 2 |
<div my-directive template-path="/app/admin/partial/common/AddUpdatePartner.html" > </div> |
temlpate-path is the path of out html file.