这是我的2个文件和错误.我正在运行Karma,这是我的karma.conf.js:https://gist.github.com/devanp92/a87c0bcc2bf5b8e17f64 .运行'karma start'后我得到了这个错误.这是一个非常简单的测试文件(或者我假设),我仍然会收到这些错误.
Main.js - 这是一个控制器
angular.module('SSLApp').controller('MainCtrl',
function($scope, $rootScope) {
$scope.thing = 1;
});
Run Code Online (Sandbox Code Playgroud)
MainSpec.js - 这是我的测试文件
describe('MainCtrl', function() {
var controller, scope;
beforeEach(angular.module('SSLApp'));
beforeEach(inject(function($controller, $rootScope) {
scope = $rootScope.$new();
controller = $controller('MainCtrl', {
$scope: scope
});
}));
it('should have scope to be defined', function(scope) {
expect(scope).toBeDefined();
});
});
Run Code Online (Sandbox Code Playgroud)
错误!看起来它在var MainCtrl = $ controller中被称为undefined ...
TypeError: 'undefined' is not a function (evaluating 'queueableFn.fn.call(self.userContext)')
at /Users/BLAH/Documents/node_modules/karma-jasmine/lib/adapter.js:184
at `http://localhost:9876/karma.js:185`
at `http://localhost:9876/context.html:53`
Error: [ng:areq] Argument 'MainCtrl' is not a function, got …Run Code Online (Sandbox Code Playgroud) 我在Angular.js中使用ng-map由于某些原因,我的地图图片在整个地图的90%处显示为灰色,如下所示:
我的HTML非常简单:
<div id="map">
<map></map>
</div>
Run Code Online (Sandbox Code Playgroud)
我甚至试图像这样添加CSS:
<style>
#map{
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
</style>
Run Code Online (Sandbox Code Playgroud)
这是我的控制器:
$scope.$on('mapInitialized', function(event, map) {
$scope.map.setCenter(new google.maps.LatLng($scope.location.latitude, $scope.location.longitude));
$scope.setZoom(4);
}
Run Code Online (Sandbox Code Playgroud)
我添加了使用ngMap的脚本.如果可能导致问题,我也删除了任何AdBlock.
编辑:google.maps.event.trigger(map,'resize'); 作品