angularjs – jsHint投掷’Firebase’未定义警告

前端之家收集整理的这篇文章主要介绍了angularjs – jsHint投掷’Firebase’未定义警告前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > How to tell JSLint / JSHint what global variables are already defined3个
如何正确定义Firebase,以便jshint停止发出哔哔声.

我的代码正在运行……只是jshint很烦人

app.js

angular
  .module('morningharwoodApp',[
    'firebase','ngAnimate','ngCookies','ngResource','ngRoute','ngSanitize','ngTouch'

  ])

main.js

angular.module('morningharwoodApp')
  .controller('MainCtrl',function ($scope,$firebase) {
    // var Firebase;
    var pageRef = new Firebase('https://morningharwood.firebaseIO.com/page');
    // var pageRef = new Firebase('https://morningharwood.firebaseIO.com/page');


    //init
    $scope.pages = $firebase(pageRef);
    $scope.newPage = {
        title: '',slug: '',url: '',desc: '',active: false,template: [
            {
                type: ''
            }
        ],img: '',dateCreated: '',dateUpdated: ''

    };

    //CRUD

    //add
    $scope.addPage = function() {
        $scope.pages.$add($scope.newPage);
        $scope.newPage = '';
    };
  });
您还可以在jshint.rc中执行以下操作
"jshint_options":
    {
        "predef": {
            "Firebase": false
        }
     }

猜你在找的Angularjs相关文章