I tried searching for the references on SO. But not satisfied with answers. I am a newbie in Angular. I am trying to achieve transclusion by creating directive like this :
app.directive('wrapperDirective',function(){
return{
restrict :'E',
controller:'wrapperCtrl',
template :'<div class="widget-template" ng-transclude></div>',
transclude: true,
replace:true,
scope:{
cityList : '='
}
}
});
app.controller('wrapperCtrl', ['$scope',function($scope, $rootScope){
$scope.citynames = $scope.cityList;
});
<wrapper-directive cityList="Bangalore">
<div>{{ citynames }}</div>
</wrapper-directive>
Now how do I make the data available declared as attribute on to the child content. I am really confused please help.