Error: [ng:areq] Angular when Ajax request to get data from php -


i trying make ajax request php angular js. not getting data have sent php file.

i'm getting error: error: [ng:areq] http://errors.angularjs.org/1.3.15/ng/areq?p0=recordsctrl&p1=not%20a%20function%2c%20got%20undefined

my source:

file app.js:

 (function () {     var app = angular.module('myapp', ['ngroute']);      app.config(function ($routeprovider) {         $routeprovider                  .when('/', {                     controller: 'contentsctrl',                     templateurl: 'views/contents.php'                 })                  .when('/jalse/:jalseid', {                     controller: 'recordsctrl',                     templateurl: 'views/jalse.php'                 })                    .otherwise({redirectto: '/'});     });  }()); 

file view.html:

<div class="content-panel">     <div class="content-panel-title">         <a href="#/records/" class="left"></a>         <h2>  {{jalse.contentdate }}</h2>     </div>  <div ng-repeat="jalse in records">                 {{jalse.contentdate }}     </div> 

file jalsefactory.js:

    (function () {      'use strict';      var jaslefactory = function ($http, $q) {          var factory = {};          factory.getjalses = function () {             var deferred = $q.defer();              $http({method: 'get', url: 'includes/records.php'}).                     success(function (data, status, headers, config) {                         deferred.resolve(data);                     }).                     error(function (data, status, headers, config) {                         deferred.reject(data);                     });             return deferred.promise;         };         return factory;     };      jaslefactory.$inject = ['$http', '$q'];     angular.module('myapp').factory('jaslefactory', jaslefactory);  }()); 

file recordsctrl.js:

 (function () {     'use strict';      var recordsctrl = function ($scope, $http, $routeparams) {         var jalseid = $routeparams.jalseid;          $scope.records = jaslefactory.getjalse();          $scope.jalse = null;          function init() {             (var = 0, len = $scope.records.length; < len; i++) {                 if ($scope.records[i].contentid == parseint(jalseid)) {                     $scope.jalse = $scope.records[i];                     break;                 }             }         }          init();      };  }()); 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -