This repository was archived by the owner on Jul 29, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
Modal unknown provider #2247
Copy link
Copy link
Closed
Description
- I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
| Item | Version |
|---|---|
| generator-angular-fullstack | 4.0.4 |
| Node | 5.4.0 |
| npm | 3.10.7 |
| Operating System | cloud9 |
| Item | Answer |
|---|---|
| Transpiler | Babel |
| Markup | HTML |
| CSS | SCSS |
| Router | ui-router |
| Client Tests | Mocha |
| DB | MongoDB |
| Auth | Y |
I cannot figure out why the Modal service injection is not working. I have added it as a dependency to the app.js and as well have added the dependency to the controller which I would like to use it from. Very desperate to get this working and appreciate anyone who can help me figure this out.
app.js
import _Auth from '../components/auth/auth.module';
import account from './account';
import admin from './admin';
import navbar from '../components/navbar/navbar.component';
import footer from '../components/footer/footer.component';
import main from './main/main.component';
import constants from './app.constants';
import util from '../components/util/util.module';
import socket from '../components/socket/socket.service';
import modal from '../components/modal/modal.service';
import './app.scss';
angular.module('camdenfirstApp', [ngCookies, ngResource, ngSanitize, 'btford.socket-io', uiRouter,
uiBootstrap, modal, _Auth, account, admin, navbar, footer, main, constants, socket, util, 'leaflet-directive'
])
.config(routeConfig)
.run(function($rootScope, $location, Auth) {
'ngInject';
// Redirect to login if route requires auth and you're not logged in
controller trying to use the Modal
import angular from 'angular';
import uiRouter from 'angular-ui-router';
import routing from './main.routes';
export class MainController {
$http;
socket;
Modal;
awesomeThings = [];
newThing = '';
camden = {autoDiscover:true};
locFound = false;
/*@ngInject*/
constructor($http, $scope, socket, Modal) {
this.Modal = Modal;
this.$http = $http;
this.socket = socket;
$scope.$on('$destroy', function() {
socket.unsyncUpdates('thing');
});
$scope.delete = this.Modal.confirm.delete()('asdf');
$scope.events = { // or just {} //all events
markers:{
enable: [ 'dragend' ]
//logic: 'emit'
}
}
$scope.camden = {autoDiscover:true};
$scope.$on('leafletDirectiveMap.locationfound', function(event){
$scope.eventDetected = "ZoomStart";
var instancePosition = {
lat: $scope.camden.lat,
lng: $scope.camden.lng,
focus: true,
message: "Drag to Flooding Instance",
draggable: true
};
$scope.markers = {
instancePosition: angular.copy(instancePosition)
}
});
$scope.$on("leafletDirectiveMarker.dragend", function(event, args){
$scope.camden.lat = args.model.lat;
$scope.camden.lng = args.model.lng;
$scope.markers.instancePosition.lat = args.model.lat;
$scope.markers.instancePosition.lng = args.model.lng;
});
}
$onInit() {
this.$http.get('/api/things')
.then(response => {
this.awesomeThings = response.data;
this.socket.syncUpdates('thing', this.awesomeThings);
});
}
addThing() {
if(this.newThing) {
this.$http.post('/api/things', {
name: this.newThing
});
this.newThing = '';
}
}
deleteThing(thing) {
this.$http.delete('/api/things/' + thing._id);
}
}
export default angular.module('camdenfirstApp.main', [uiRouter])
.config(routing)
.component('main', {
template: require('./main.html'),
controller: MainController
})
.name;
EDIT: if you;d like to see the project itself you can find it here: https://camden-first-hopeworks.c9users.io:8081/
Metadata
Metadata
Assignees
Labels
No labels
Activity
Awk34 commentedon Sep 20, 2016
Please surround your different code blocks with triple ticks (```). Your code is quite hard to read as-is.
hopeworkscamden commentedon Sep 20, 2016
@Awk34 sorry about that, I have updated
Awk34 commentedon Sep 20, 2016
Can you provide a full stack trace as well?
hopeworkscamden commentedon Sep 21, 2016
here is the full error that occurs
angular.js:13920ReferenceError: Modal is not defined
at new MainController (https://camden-first-hopeworks.c9users.io:8081/app.bundle.js:1143:19)
at Object.invoke (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:4845:20)
at $controllerInit (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:10481:35)
at nodeLinkFn (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:9390:35)
at compositeLinkFn (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:8747:14)
at publicLinkFn (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:8627:31)
at Object. (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:38087:10)
at https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:1374:19
at invokeLinkFn (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:10061:10)
at nodeLinkFn (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:9462:12)
at compositeLinkFn (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:8747:14)
at publicLinkFn (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:8627:31)
at lazyCompilation (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:8971:26)
at updateView (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:38005:24)
at https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:37954:12
at Scope.$broadcast (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:18132:29)
at https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:37335:23
at processQueue (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:16510:29)
at https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:16526:28
at Scope.$eval (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:17809:29)
at Scope.$digest (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:17622:32)
at Scope.$apply (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:17917:25)
at bootstrapApply (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:1888:16)
at Object.invoke (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:4845:20)
at doBootstrap (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:1886:15)
at Object.bootstrap (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:1906:13)
at https://camden-first-hopeworks.c9users.io:8081/app.bundle.js:93:22
at HTMLDocument.trigger (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:3334:8)
at defaultHandlerWrapper (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:3624:12)
at HTMLDocument.eventHandler (https://camden-first-hopeworks.c9users.io:8081/vendor.bundle.js:3612:10)
thedewpoint commentedon Sep 21, 2016
Can you post what's in modal.service? You're expecting the import to provide you a module name but I'm not sure that's what you're importing
hopeworkscamden commentedon Sep 22, 2016
Azayzel commentedon Sep 23, 2016
Your specific issue seems to be case. In your app.js you're importing with lowercase 'm' but in your controller your using it as 'M'. Try fixing it to a capital 'M' when importing and in your injection.
With that being said; i am also having trouble with this Modal. When i call $uibModal directly from my controller it works the way a Modal should. But not via this service.
Azayzel commentedon Sep 23, 2016
Ive created a PR that fixes this issue. #2256
The problem lies at the export of the factory. Change
to
hopeworkscamden commentedon Sep 26, 2016
Thanks @Azayzel ! I really appreciate it! Got my first modal to pop up today using the Modal service. Next stop is injecting the controller scope i'm calling the modal from into the modal itself.
marwenlandoulsi commentedon Dec 29, 2016
Please i need help. i have got this bug :
vendor.bundle.js:14047 Error: [$injector:strictdi] Modal is not using explicit annotation and cannot be invoked in strict mode
http://errors.angularjs.org/1.5.8/$injector/strictdi?p0=Modal
at http://localhost:8086/vendor.bundle.js:195:13
at Function.annotate [as $$annotate] (http://localhost:8086/vendor.bundle.js:4079:18)
at injectionArgs (http://localhost:8086/vendor.bundle.js:4806:37)
at Object.invoke (http://localhost:8086/vendor.bundle.js:4837:19)
at Object.enforcedReturnValue [as $get] (http://localhost:8086/vendor.bundle.js:4684:38)
at Object.invoke (http://localhost:8086/vendor.bundle.js:4845:20)
at http://localhost:8086/vendor.bundle.js:4644:38
at getService (http://localhost:8086/vendor.bundle.js:4791:40)
at injectionArgs (http://localhost:8086/vendor.bundle.js:4815:59)
at Object.instantiate (http://localhost:8086/vendor.bundle.js:4857:19)
at $controller (http://localhost:8086/vendor.bundle.js:10496:29)
at Object. (http://localhost:8086/vendor.bundle.js:38077:29)
at http://localhost:8086/vendor.bundle.js:1374:19
at invokeLinkFn (http://localhost:8086/vendor.bundle.js:10061:10)
at nodeLinkFn (http://localhost:8086/vendor.bundle.js:9462:12)
at compositeLinkFn (http://localhost:8086/vendor.bundle.js:8747:14)
at publicLinkFn (http://localhost:8086/vendor.bundle.js:8627:31)
at lazyCompilation (http://localhost:8086/vendor.bundle.js:8971:26)
at updateView (http://localhost:8086/vendor.bundle.js:38005:24)
at http://localhost:8086/vendor.bundle.js:37954:12
at Scope.$broadcast (http://localhost:8086/vendor.bundle.js:18132:29)
at http://localhost:8086/vendor.bundle.js:37335:23
at processQueue (http://localhost:8086/vendor.bundle.js:16510:29)
at http://localhost:8086/vendor.bundle.js:16526:28
at Scope.$eval (http://localhost:8086/vendor.bundle.js:17809:29)
at Scope.$digest (http://localhost:8086/vendor.bundle.js:17622:32)
at Scope.$apply (http://localhost:8086/vendor.bundle.js:17917:25)
at bootstrapApply (http://localhost:8086/vendor.bundle.js:1888:16)
at Object.invoke (http://localhost:8086/vendor.bundle.js:4845:20)
at doBootstrap (http://localhost:8086/vendor.bundle.js:1886:15)
at Object.bootstrap (http://localhost:8086/vendor.bundle.js:1906:13)
at http://localhost:8086/app.bundle.js:100:22
at HTMLDocument.trigger (http://localhost:8086/vendor.bundle.js:3334:8)
at defaultHandlerWrapper (http://localhost:8086/vendor.bundle.js:3624:12)
at HTMLDocument.eventHandler (http://localhost:8086/vendor.bundle.js:3612:10)
Any solution ??
zaphinath commentedon Apr 24, 2017
I'm seeing the same issue - angular.js:14525 Error: [$injector:strictdi] Modal is not using explicit annotation and cannot be invoked in strict mode.
Any solution?
thedewpoint commentedon Apr 24, 2017
zaphinath commentedon Apr 24, 2017
#2203 Fixed the issue.