angularjs - Can't able to connect my controller with html properly in Angular js -


here code, cant able ajax call, getting errors here. don,t know how clear that, can me please.

 var app = angular.module('app',['ui.router']);    app.controller('postctrl',['$scope','$http',function($scope,$http){  	console.log('inside jobpost');      $http.get("/api/job-posts").success(function(data, status, headers, config) {          $scope.items = data.data;      }).error(function(data, status, headers, config) {          console.log("no data found..");    });  });    app.filter('searchfor', function(){      return function(arr, searchstring){          if(!searchstring){              return arr;          }          var result = [];          searchstring = searchstring.tolowercase();          angular.foreach(arr, function(item){              if(item.title.tolowercase().indexof(searchstring) !== -1){              result.push(item);          }          });          return result;      };  }]);
   <!-- <body ng-app="app"> -->          <div ng-controller="postctrl">              <h3 class="headname">ajax search using angularjs</h3>              <div class="bar">                  <input type="text" class="search" ng-model="searchstring" placeholder="enter search terms" />              </div>              <ul class="data-ctrl">                  <li ng-repeat="i in items | searchfor:searchstring">                      <p>{{i.title}}                  </li>              </ul>     

i try solve in many ways can't able clear.

try this... missing ) in line 33

var app = angular.module('app',['ui.router']);  app.controller('postctrl',['$scope','$http',function($scope,$http){     console.log('inside jobpost');     $http.get("/api/job-posts").success(function(data, status, headers, config) {         $scope.items = data.data;     }).error(function(data, status, headers, config) {         console.log("no data found..");   }); }]);  app.filter('searchfor', function(){     return function(arr, searchstring){         if(!searchstring){             return arr;         }         var result = [];         searchstring = searchstring.tolowercase();         angular.foreach(arr, function(item){             if(item.title.tolowercase().indexof(searchstring) !== -1){                 result.push(item);             }         });         return result;     }; }); 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo