2015-07-07 3 views
0

ошибка, показывающая вот так, я не знаю, что случилось с синтаксисом, я попробовал много способов ее исправить. он просто показывает инжектор: unpr. Может ли помочь какой-либо орган?

Error: [$injector:unpr] http://errors.angularjs.org/1.4.1/$injector/unpr?p0=intervalProvider%20%3C-%20interval%20%3C-%20chatList 
    at Error (native) 
    at http://localhost/.../public/assets/js/angular.min.js:6:416 
    at http://localhost/.../public/assets/js/angular.min.js:40:239 
    at Object.d [as get] (http://localhost/.../public/assets/js/angular.min.js:38:225) 
    at http://localhost/.../public/assets/js/angular.min.js:40:313 
    at d (http://localhost/sahra2/public/assets/js/angular.min.js:38:225) 
    at Object.e [as invoke] (http://localhost/.../public/assets/js/angular.min.js:38:495) 
    at $get.Q.instance (http://localhost/../public/assets/js/angular.min.js:80:122) 
    at N (http://localhost/.../public/assets/js/angular.min.js:61:181) 
    at g (http://localhost/.../public/assets/js/angular.min.js:54:386) 

app.js

var App = angular.module('App',['luegg.directives'], function($interpolateProvider){ 
    $interpolateProvider.startSymbol('{$'); 
    $interpolateProvider.endSymbol('!}'); 
}); 
App.controller('sendMails', function($scope, $http){ 
    $scope.submit=function(){ 
     alert($scope.fromMail); 
     if($scope.fromMail){ 
      var mailData={ 

       method : 'POST', 
       url  : 'http://localhost/.../public/auth/mail', 
       header :{ 
        'Content-Type' : 'application/x-www-form-urlencoded' 
       }, 
       data :{ 
        secureKey : 'tie44jfuho9piya7219', 
        fromMail : $scope.fromMail, 
        mailto  : $scope.mailto, 
        subject  : $scope.subject, 
        message  : $scope.message 
       } 
      } 
      $http(mailData) 
       .success(function(response){ 
        alert(response.status); 
       }) 
       .error(function(){ 
        alert('error'); 
       }); 
     } 
    } 
}); 
var app2 = angular.module('App'); 
app2.controller('chatList', function($scope, $http, interval){ 
    interval(function(){ 
     $http.get('localhost/.../public/auth/chat') 
      .success(function(response){ 
       $scope.chats = response; 
      }); 
    },1000); 
}); 

и app.php

<form ng-submit="submit()" ng-controller="sendMails"> 
        <div class="box-body"> 
          <div class="form-group"> 
           <input type="hidden" class="form-control" ng-model="fromMail" name="fromMail" ng-init="fromMail='{{ Auth::user()->userID}}'" /> 
           <input type="text" class="form-control" ng-model="mailto" name="emailto" placeholder="Email to:"/> 
          </div> 
          <div class="form-group"> 
           <input type="text" class="form-control" ng-model="subject" name="subject" placeholder="Subject"/> 
          </div> 
          <div> 
           <textarea ng-model="message" placeholder="Message" style="width: 100%; height: 125px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea> 
          </div> 
        </div> 
        <div class="box-footer clearfix"> 
         <button class="pull-right btn btn-default" type="submit" id="sendEmail">Send <i class="fa fa-arrow-circle-right"></i></button> 
        </div> 
        </form> 
<div class="box-body chat" id="chat-box" ng-controller="chatList"> 
         <!-- chat item --> 
         <div class="item" ng-repeat="x in chats"> 
          <img src="dist/img/user4-128x128.jpg" alt="user image" class="online"/> 
          <p class="message"> 
           <a href="#" class="name"> 
            <small class="text-muted pull-right"><i class="fa fa-clock-o"></i> 2:15</small> 
            {$ x.name !} 
           </a> 
           I would like to meet you to discuss the latest news about 
           the arrival of the new theme. They say it is going to be one the 
           best themes on the market 
          </p> 

         </div><!-- /.item --> 
         <!-- chat item --> 

        </div><!-- /.chat --> 

, что неправильно, показывая ошибки [$ Инжектор: unpr]

ответ

0

Вы не предоставили $ инъекционного interval

попробуйте вот так

function($scope, $http, $interval){ 
    $interval(function(){ 
     // do stuff 
    },1000); 

} 
+0

Добро пожаловать :) –

Смежные вопросы