繁体   English   中英

JSHint一些错误

[英]JSHint some errors

为什么JSHint说我:

JSHint:缺少分号(W033)对于'use strict'

JSHint:未定义“ myApp”。 (W117)

controller.js:

'use strict'
myApp.controller('NavbarCtrl', function NavbarController($scope, $location) {
    $scope.routeIs = function (routeName) {
        return $location.path() === routeName;
    };
});
...

这两个错误都是不言自明的。

JSHint:缺少分号(W033)对于“使用严格”和

use strict;后加分号use strict;

JSHint:未定义“ myApp”。 (W117)

这意味着未定义myApp 您可以像这样简单地定义它:

var myApp

您已经打开了一个类似的问题,现在是这个。 请在单个帖子中问所有类似的问题。

这是适用于您的更新代码。

/* global myApp*/ //if myApp is defined in some file globally.
'use strict';

var myApp; // if myApp is not defined earlier.
myApp.controller('NavbarCtrl', function NavbarController($scope, $location) {
    $scope.routeIs = function (routeName) {
        return $location.path() === routeName;
    };
});
...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM