<emp-label append-text="Text that you want to appear before the emp details: "></emp-label>
(function () {
var empLabel = angular.module("enggedu").directive("empLabel", function () {
return {
restrict: "E",
replace: true,
scope: true,
require: "^urlEmployee",
templateUrl:"/app/directives/emplabel/emplabel.html",
compile:function (elem, attrs) {
return {
pre: function (scope, elem, attrs) {
//this is where it gets all the appending text
scope.appendText= $(elem[0]).attr("append-text");
console.log("emplabel/pre function: we have the value of the text that is to be appended:" + scope.appendText);
},
post: function (scope, elem, attrs, parentController) {
console.log("emp-label/controller: do we have access to the scope on the main controller ?");
console.log("emp-label/controller: value of the emp email " + scope.emp.email);
}
}
},
controller: function ($scope) {
}
}
})
})();