Hi,
Below is my code for my custum directive:
(function (global, undefined) {
'use strict';
// used to render the styled checkboxes
global.adminControllers.directive("inputwrap", ["$compile", function
($compile) {
return {
restrict: "E",
transclude: true,
replace: true,
scope: {
errors: "=",
label: "@",
hideClose: "@"
},
template: '<div class="inputWrap" ng-class="{\'has-error\':
errors.length>0, \'collapsedError\': !showError}">' +
'<div class="errorMessage"
ng-show="showError">' +
'<i class="fa fa-times-circle
closeErrorBtn" ng-hide="hideClose" ng-click="showError = false"></i>' +
'<label>{{label}}</label>' +
'<div ng-show="errors" ng-repeat="error in
errors">{{ error }}</div>' +
'</div>' +
'<div ng-transclude></div>' +
'</div>',
link: function (scope, elm, attrs)
{
var showError = function () {
scope.$apply(function () {
scope.showError = true;
});
};
*elm.find("input, select, textarea").on("focus",
showError).on("select2-focus", showError);*
scope.$watch("errors", function () {
// if the error was closed manually, don't reopen
automatically
if (scope.showError === undefined)
scope.showError = scope.errors &&
scope.errors.length > 0;
});
}
}
}]);
}(window));
*Html for the directive:*
<inputwrap errors="formErrors.saveReport.name" label="Report name">
<input type="text"
class="form-control"
id="saveReportName"
" />
</inputwrap>
Please focus on the line I have marked bold and underline. In Chrome,
Firefox, IE9 and > it is working fine. In IE8 this line is not working
since it is not able to find any element in it.
Thanks in advance if some one have any solution for it.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.