Hi All, I've a question, i.e. if want to change the templateUrl value based
on the attribute value of a custom directive. let suppose if you have bound
the values using "ng-repeat" directive now if we wanted to change the
templateUrl value based on the attribute value.
*<div ng-app="myApp"> <div ng-controller="myController">*
* <div ng-repeat="num in list"> <my-name numb="{{num}}" ></my-name>*
* </div>*
* <div> </div>*
angular.module('myApp', [])
.controller('myController', ['$scope', function ($scope) { $scope.list =
[1, 2, 3, 4, 5, 6, 7]; }])
.directive("myName", [ function () {
return {
templateUrl: function (elem, attr) {
* if(attr.numb==1)*
* return "sample1.html"; *
* if(attr.numb==2)*
* return "sample2.html"; *
* if(attr.numb==3)*
* return "sample3.html"; *
* -------*
}
};
}]);
how to accomplish the above problem?
Thanks In Advance.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.