This is a followup to this question. I have the same setup:
Angular scope is shared for all modules and controllers
So root module, controllers and directives. Now to the question:
I have a service, that has this written inside:
firstModule.factory("firstService", function () {
return {
$('.mainitems').click(function () {
alert("hi")
});
};
});
And a directive, that is nested inside other directive:
secondModule.directive("secondDirective", function () {
return {
templateUrl: "./myurl",
restrict: "E",
replace: true,
compile: function (tElement, tAttrs, controller) {
return {
}
}
}
});
When I have the line : restrict: "E"
, the click function does not work, but when I remove it, then it works.
Any idea why this may be the problem? It's a strange thing, after a day of debugging I found the issue.