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