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

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

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

app.js

  1. angular
  2. .module('morningharwoodApp',[
  3. 'firebase','ngAnimate','ngCookies','ngResource','ngRoute','ngSanitize','ngTouch'
  4.  
  5. ])

main.js

  1. angular.module('morningharwoodApp')
  2. .controller('MainCtrl',function ($scope,$firebase) {
  3. // var Firebase;
  4. var pageRef = new Firebase('https://morningharwood.firebaseIO.com/page');
  5. // var pageRef = new Firebase('https://morningharwood.firebaseIO.com/page');
  6.  
  7.  
  8. //init
  9. $scope.pages = $firebase(pageRef);
  10. $scope.newPage = {
  11. title: '',slug: '',url: '',desc: '',active: false,template: [
  12. {
  13. type: ''
  14. }
  15. ],img: '',dateCreated: '',dateUpdated: ''
  16.  
  17. };
  18.  
  19. //CRUD
  20.  
  21. //add
  22. $scope.addPage = function() {
  23. $scope.pages.$add($scope.newPage);
  24. $scope.newPage = '';
  25. };
  26. });
您还可以在jshint.rc中执行以下操作
  1. "jshint_options":
  2. {
  3. "predef": {
  4. "Firebase": false
  5. }
  6. }

猜你在找的Angularjs相关文章