Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何使用角度延迟引导设置业力&;加载JSON文件?_Angularjs_Karma Runner_Karma Jasmine - Fatal编程技术网

Angularjs 如何使用角度延迟引导设置业力&;加载JSON文件?

Angularjs 如何使用角度延迟引导设置业力&;加载JSON文件?,angularjs,karma-runner,karma-jasmine,Angularjs,Karma Runner,Karma Jasmine,我一直在尝试为一个新的angular项目设置Karma配置,该项目使用angular延迟引导加载配置文件(JSON)。当Karma加载时,它会给我错误,它无法找到app.json文件 这是我的角度模块 angular.module('CareerPortal', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize']); // Defer the application until we have the configuration for th

我一直在尝试为一个新的angular项目设置Karma配置,该项目使用angular延迟引导加载配置文件(JSON)。当Karma加载时,它会给我错误,它无法找到
app.json
文件

这是我的角度模块

angular.module('CareerPortal', ['ngAnimate', 'ngCookies', 'ngTouch', 'ngSanitize']);

// Defer the application until we have the configuration for the app!
deferredBootstrapper.bootstrap({
  element: document.body,
  module: 'MyApp',
  resolve: {
    configuration: ['$http', function ($http) {
        return $http.get('app.json');
    }]
  }
});
这是我的因果报应

function listFiles() {
var wiredepOptions = _.extend({}, conf.wiredep, {
    dependencies: true,
    devDependencies: true
});

return wiredep(wiredepOptions).js
    .concat([
        path.join(conf.paths.tmp, '/serve/app/index.module.js'),
        path.join(conf.paths.src, '/**/*.spec.js'),
        path.join(conf.paths.src, '/**/*.mock.js'),
        path.join(conf.paths.src, '/**/*.html')
    ]);
}

module.exports = function (config) {
  var configuration = {
    files: listFiles(),

    singleRun: true,

    autoWatch: false,

    debug: true,

    frameworks: ['jasmine'],

    ngHtml2JsPreprocessor: {
        stripPrefix: 'src/',
        moduleName: 'CareerPortal'
    },

    browsers: ['PhantomJS'],

    plugins: [
        'karma-phantomjs-launcher',
        'karma-jasmine',
        'karma-ng-html2js-preprocessor'
    ],

    preprocessors: {
        'src/**/*.html': ['ng-html2js']
    }
  };

  config.set(configuration);
};
然后JSON文件就是一个标准的JSON文件

这是我得到的错误

INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Mac OS X 0.0.0)]: Connected on socket 6MHhNTNq1d3djLp7R0z3 with id 21194787
WARN [web-server]: 404: /app.json
PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0.001 secs / 0 secs)
[18:23:44] Finished 'test' after 1.71 s