Hi all!
I have shareApp module like the code bellow:
var sharedApp = angular.module("sharedApp", []);
sharedApp.directive("showAvatar", function () {
var directive = {
restrict: "ACEM",
replace: true,
template: "<h2>This is directive template of shared module</h2>"
};
return directive;
});
sharedApp.directive("showAvatar", function () {
function directive(){
this.restrict= "ACEM";
};
return directive;
});
I also have emailApp module like the code bellow:
//email module
var emailApp = angular.module("emailApp", ["sharedApp"]);
emailApp.directive("showAvatar", function () {
var directive = {
restrict: "ACEM",
replace: true,
template: "<h2>This is directive template of email module</h2>"
};
return directive;
});
In my index.html. I define it use sharedApp and call <show-avatar>
directive. The result will call the directive "showAvatar" in module
"sharedApp". My issue is that I would like to call directive with module
name so I don't need to use ng-app. For example: <sharedApp:show-avatar> or
<emailApp:show-avatar> or something like that. I know it's not a right
systax. Is it possible?
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.css">
</head>
<body>
<main ng-app="sharedApp" class="container" style="margin-top:50px">
<h1>Welcome to AngularJs</h1>
<show-avatar></show-avatar>
</main>
<script src="js/angular.js"></script>
<script src="js/app.js"></script>
</body>
</html>
--
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.