You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I am making this feature request keeping in mind that #8977 and #3881 have been closed (but not resolved) as the OP deemed their feature request not necessary anymore, but I've found use case for it. Please bear with me and I would really like to contribute to the repo and make this functionality available if I can get help figuring out where to start looking; there's clearly expression over the web of people liking something like this.
With the following I would like to be able to define a module the first time and then change it on the fly later on. The reason is that my modules are dynamically generated and I'd rather reload one module than the whole app once One JavaScript file changes; it is Huge and Slow to load. The JS files are watched for changes and loaded lazily but always the initial module persists, i.e. 'This will be logged the first time' always gets logged even though the new JavaScript executes it does not overwrite the old module.
I think this would be a great tool for the AngularJS community but I don't know as yet it if it's already possible (I keep reading it's not). Alternatively I'd be happy if I could achieve the same using controllers/directives/1.5components
// First state of angular module
angular.module('myApp.view1', [])
.controller('View1Ctrl', ['$scope',function($scope) {
$scope.buttonClick = function () {
console.log('This will be logged first time');
}
}]);
// Second state of angular module
angular.module('myApp.view1', [])
.controller('View1Ctrl', ['$scope',function($scope) {
$scope.buttonClick = function () {
console.log('This will be logged the second time');
}
}]);
Replacing modules is a pretty slippery slope. You can easily end up into an inconcistent state, where some of your different services/controllers/directives/views are using different versions of their dependencies.
We are considering adding support for lazily loading modules though. This is tracked in #11015.
There are also 3rd party modules that are offering this functionality already.
I'm closing this as a duplicate of #11015. Let's continue the discussion there.
I am making this feature request keeping in mind that #8977 and #3881 have been closed (but not resolved) as the OP deemed their feature request not necessary anymore, but I've found use case for it. Please bear with me and I would really like to contribute to the repo and make this functionality available if I can get help figuring out where to start looking; there's clearly expression over the web of people liking something like this.
With the following I would like to be able to define a module the first time and then change it on the fly later on. The reason is that my modules are dynamically generated and I'd rather reload one module than the whole app once One JavaScript file changes; it is Huge and Slow to load. The JS files are watched for changes and loaded lazily but always the initial module persists, i.e. 'This will be logged the first time' always gets logged even though the new JavaScript executes it does not overwrite the old module.
I think this would be a great tool for the AngularJS community but I don't know as yet it if it's already possible (I keep reading it's not). Alternatively I'd be happy if I could achieve the same using controllers/directives/1.5components
Here is a further working example if anything is still not clear http://jsbin.com/xirixusuyu
The text was updated successfully, but these errors were encountered: