Skip to content

Commit

Permalink
AngularJs app
Browse files Browse the repository at this point in the history
  • Loading branch information
raylight75 committed Feb 25, 2016
1 parent 4d7b6ab commit 73b62a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions public/js/productCtrl.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
var myApp = angular.module('myApp', ['angular-toArrayFilter']);
myApp.controller('productCtrl', function ($scope, $http) {
$scope.$watch('products', function () {
fetch();
$http.get("api").then(function (response) {
console.log(response);
$scope.items = response.data;
$scope.orderProp = 'product_id';
$scope.latest = 6;
});
function fetch() {
$http.get("api").then(function (response) {
console.log(response);
$scope.items = response.data;
$scope.orderProp = 'product_id';
$scope.latest = 6;
});
}
}
);
2 changes: 1 addition & 1 deletion resources/views/frontend/livesearch.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<!-- TOVAR -->
<div ng-app="myApp" ng-controller="productCtrl">
<h3>Type a letter in the input field:</h3>
<h3>Type a letter:</h3>
<p><input type="text" ng-model="products"></p>
<div ng-repeat="row in items | toArray : false | filter:products | orderBy:orderProp | limitTo:latest"
class="col-lg-3 col-md-3 col-sm-4 col-xs-6 col-ss-12 padbot40">
Expand Down

0 comments on commit 73b62a0

Please sign in to comment.