When working in html, I passed an object into a directive like this:
<lcd-code ldcCode="{{ detail.program.ldcCode }}"></lcd-code>
The value of detail.program.ldcCode is "PSIH"...
However, in the Directive, it is showing up as undefined:
var lcdCode = function (customerService, $sce) {
return {
replace: true,
restrict: "E",
scope: {
ldcCode: "=" // two way
},
link: function (scope, element, attrs) {
console.log('scope.ldcCode',scope.ldcCode); // says undefined
}
};
}
Before, I was using "@", and then attrs.ldcCode seemed to work... I realized that 2-way data binding was the end result I wanted for the data I was working with and sending back.