我的问题是:
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module function Loki(filename, options) due to:
Error: [$injector:unpr] Unknown provider: filename
我使用Agular 1.6和lokiJs进行角度调整。 代码在ES6中使用webpack格式化。
注意我在控制器中评论了对Loki的所有引用。 只使用注射。
export default class loginController{
constructor($scope, Loki, $mdDialog, $timeout, $location, $cookies){
console.log('foo');
if($cookies.get('user')){
$location.path('/programmes');
}
this.user = {
login:'plop',
pwd:undefined
}
var db_name = 'app.db';
//var db = new Loki('${db_name}');
var profiles;
/*
db.loadDatabase({},function(){
return profiles = db.getCollection('profiles') || db.addCollection('profiles');
});
*/
console.log('ttoot');
this.ui = {
'shake' :false,
'register': false,
};
}
用于控制器和我的app.js:
import angular from 'angular';
import ngMaterial from 'angular-material';
import ngAnimate from 'angular-animate';
import ngMessage from 'angular-messages';
import ngRoute from 'angular-route';
import ngCookies from 'angular-cookies';
import lokijs from 'lokijs';
/*import './../dependencies/loki/lokijs.js';
import loki from './../dependencies/loki/loki-angular.js';
*/
import uirouter from 'angular-ui-router';
import appLogin from './components/login/login.module.js';
import appProg from './components/programmes/prog.module.js';
import appSeance from './components/seances/seances.module.js';
import router from './configs/routing.js';
import run from './run/run.js';
angular.module('app', [
ngMaterial,
ngAnimate,
ngMessage,
ngRoute,
ngCookies,
appLogin,
appProg,
appSeance,
lokijs,
uirouter,
])
.config(router)
.run(run)
;
感谢您的帮助!