As a newcomer to the world of javascript
and just beginning to work with angular.js
, I have a question.
I'm wondering if there is a method for injecting a controller into a module that is declared within an anonymous function.
This is how my code currently appears:
app.js
(function(angular) {
var app = angular.module('Organizer', ['ngMaterial', 'ngAnimate', 'ngAria']);
})(angular);
siteController.js
(function(angular, app) {
app.controller('site', function($scope, $mdDialog)
{
var alert = $mdDialog.alert({
title: 'Test',
content: 'Testing',
ok: 'Exit'
});
$mdDialog.show(alert);
});
})(angular);
I've attempted to find solutions on whether this is possible, but I am eager to hear explanations from anyone here who may know how to achieve this.
Note: While I have previous experience with angular.js
, I wanted to explore a different approach for declaring controllers in order to prevent client modifications.