Caution: Angular rookie in action.
I'm attempting to craft a personalized widget that initially displays a "Reply" link, and upon clicking it, should hide the link and reveal a textarea. Here's my current progress, but unfortunately, it's not functioning as expected:
.directive('replybox', function ($rootScope) {
var linkFn = function (scope, element, attrs) {
var label = angular.element(element.children()[0]);
scope.showInput = false;
label.bind("click", showTextbox);
function showTextbox() {
scope.showInput = true;
}
};
return {
link:linkFn,
restrict:'E',
scope:{
id:'@',
label:'@',
showInput:'='
},
template:'<a ng-hide="showInput">label</a><textarea ng-show="showInput"> </textarea>',
transclude:true
};
})
Any advice or guidance would be greatly appreciated. Thank you!