我有一点时间试图弄清楚为什么我在Angular中收到了未知提供程序错误.我已经检查了我能找到的关于这个问题的所有其他问题,并且大多数建议依赖注入错误.然而,在我看来,我不会忘记注入任何东西.我一直试图让这个解决方案的属性像Misko的这篇文章一样工作.我能够在解决后解决登出员工数据的问题,但随后我收到了未知提供程序错误,这会阻止数据显示在页面上.
这是我的路由器:
"use strict";
var app = angular.module('app',[
'employeeServices'
]);
app.config(appRouter);
function appRouter ($routeProvider) {
$routeProvider
.when('/employees/:account_id', {
controller: 'EmployeeCtrl',
templateUrl: 'view/employee/view.html',
resolve: employeeCtrl.resolve
})
.otherwise({ redirectTo: '/' });
}
Run Code Online (Sandbox Code Playgroud)
这是我的控制器
var employeeCtrl = app.controller('EmployeeCtrl', [
'$scope',
'employees',
function ($scope, employees) {
$scope.employee = employees;
console.log($scope.employee);
}
]);
employeeCtrl.resolve = {
employees: function (Employee, $q, $route) {
var deferred = $q.defer();
console.log("current params: ", $route.current.params.account_id);
Employee.getOne({ id: $route.current.params.account_id }, function (successData) {
deferred.resolve(successData);
}, function (errorData) {
deferred.reject(errorData); …Run Code Online (Sandbox Code Playgroud) 我试图按照此处列出的配置在我的测试中禁止显示警告:https : //vue-test-utils.vuejs.org/api/config.html#silent,如下所示:
import { config } from '@vue/test-utils';
// this should actually be the default but the default is not working
config.silent = true;
Run Code Online (Sandbox Code Playgroud)
但是,我仍然在测试结果中看到警告:
TheQueue
? should show the queue bar if there are items queued
? should show the correct count of queued items in queued bar
[Vue warn]: Avoid mutating a prop directly since the value will be
overwritten whenever the parent component re-renders. Instead, use a
data or computed property based on the …Run Code Online (Sandbox Code Playgroud) 我正试图运行gulp,我从承办者那里得到这个问题:
? gulp serve
[20:13:12] Requiring external module babel-core/register
[20:13:12] Loading /Users/Sites/my-site/gulp/tasks/clean.js
[20:13:12] Loading /Users/Sites/my-site/gulp/tasks/deploy.js
[20:13:12] Loading /Users/Sites/my-site/gulp/tasks/icons.js
[20:13:13] Loading /Users/Sites/my-site/gulp/tasks/images.js
[20:13:13] Loading /Users/Sites/my-site/gulp/tasks/scripts.js
[20:13:13] Loading /Users/Sites/my-site/gulp/tasks/serve.js
[20:13:13] Loading /Users/Sites/my-site/gulp/tasks/siteAssets.js
[20:13:13] Loading /Users/Sites/my-site/gulp/tasks/siteTemplates.js
[20:13:13] Loading /Users/Sites/my-site/gulp/tasks/styles.js
[20:13:13] Loading /Users/Sites/my-site/gulp/tasks/templates.js
/Users/Sites/my-site/node_modules/undertaker/lib/helpers/validateRegistry.js:34
throw err;
^
AssertionError: Custom registry must have `init` function
at validateRegistry (/Users/Sites/my-site/node_modules/undertaker/lib/helpers/validateRegistry.js:28:5)
at Gulp.registry (/Users/Sites/my-site/node_modules/undertaker/lib/registry.js:18:3)
at Object.<anonymous> (/Users/Sites/my-site/gulpfile.babel.js:11:6)
at Module._compile (module.js:435:26)
at normalLoader (/Users/Sites/my-site/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/Sites/my-site/node_modules/babel-core/lib/api/register/node.js:216:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17) …Run Code Online (Sandbox Code Playgroud) 我试图弄清楚为什么我们的UI在从开发迁移到生产后已完全改变.这是UI在开发中的样子:
这是改变我们的API调用和从开发中迁移我们的品牌后的样子:
注意完全不同的标题,现在右边有一个侧边栏?是什么赋予了?我在任何从开发到生产的迁移文档中都没有提到这一点.