得到的ReferenceError:找不到变量:角 [英] getting ReferenceError: Can't find variable: angular

查看:321
本文介绍了得到的ReferenceError:找不到变量:角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的自耕农和它使用的所有工具。我创建了一个测试项目中的自耕农,并试图运行茉莉测试规范。
我已经安装使用CMD茉莉花插件:

I am new to yeoman and all the tools it uses. I have created a test project in yeoman and trying to run the test spec in jasmine. I have installed the jasmine plugin using cmd:

NPM安装咕噜-的contrib - 茉莉--save-dev的

添加了茉莉花任务Gruntfile.js

Added a jasmine task in Gruntfile.js

jasmine: {
        src:    '<%= yeoman.app %>/scripts/{,*/}*.js',
        specs: 'test/spec/{,*/}*.js'
    },

当我运行茉莉花任务的咕噜茉莉我得到以下错误: -

when i run the jasmine task grunt jasmine i get following error:-

E:\Personal Projects\yeoman-projects\test-app>grunt jasmine
Running "jasmine:src" (jasmine) task

Testing jasmine specs via phantom
ReferenceError: Can't find variable: angular at
..\..\..\E:\Personal%20Projects\yeoman-projects\test-app\app\scripts\app.js:3

ReferenceError: Can't find variable: angular at
..\..\..\E:\Personal%20Projects\yeoman-projects\test-app\app\scripts\controll
ers\main.js:3

以下是我main.js

Following is my main.js

'use strict';

angular.module('testAppApp')
  .controller('MainCtrl', function ($scope) {
    $scope.awesomeThings = [
      'HTML5 Boilerplate',
      'AngularJS',
      'Karma'
    ];
  });

和app.js

'use strict';

angular.module('testAppApp', [
  'ngRoute'
])
  .config(function ($routeProvider) {
    $routeProvider
      .when('/', {
        templateUrl: 'views/main.html',
        controller: 'MainCtrl'
      })
      .otherwise({
        redirectTo: '/'
      });
  });

我这么想吗?

谢谢,
Parikshit

Thanks, Parikshit

推荐答案

。现在你只包括你自己的脚本。如果您正在使用yeaoman,他们是usally一个文件夹名为bower_components /棱角分明。

under jasmine src you have to include angular.js. For now you have only included you own scripts. If you are using yeaoman, they are usally in a folder called bower_components/angular.

这篇关于得到的ReferenceError:找不到变量:角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆