In Angular 1.5, there is no link and component. So with If you transclude, you cannot access the fifth arguement in link function, which is transcludefn.
But in v1.5, you can access $transclude in controller.
And what are the can do for so is check whether the transclude element was passed in or not. For the also need to use named slots, not default transclude:true.
See Example:
classServicelistcontroller {Constructor ($transclude) { This. $transclude =$transclude; } hastransclude () {return This. $transclude. isslotfilled ('Actions'); }}ConstClmservicelistcomponent ={bindings: {...}, transclude: {'Actions':'? clmactions'}, Controller:servicelistcontroller, Controlleras:'VMS', Template:require ('./service-list.html')};exportdefault(ngmodule) ={ngmodule.component ('clmservicelist', clmservicelistcomponent);}
In the example, we have a directive call ' clmactions ', and gave slot name as ' actions '.
So-can use:
this. $transclude. isslotfilled ('actions');
To check whether the transclude element was defined or not.
In HTML:
< clm-service-list > < clm-actions > < ></clm-action> </clm-actions > </ clm-service-list >
If we gave the clm-actions tag, the Hastransclude () function in controller would return ' true ' if you remove clm-actions t AG, the function would return false.
[AngularJS] Angular 1.5 $transclude with name slot