Angular JS

Angular JS Dynamic searching for a collection of objects, with min & max range (i.e., persons with age from 18 to 60)

View:- <div ng-repeat=”car in cars | filter: byRange(fieldname, min_value, max_value” > ……. …… </div> Controller:- $scope.byRange = function (fieldName, minValue, maxValue) { if (minValue === undefined) minValue = Number.MIN_VALUE; if (maxValue === undefined) maxValue = Number.MAX_VALUE; return function predicateFunc(item) { return minValue <= item[fieldName] && item[fieldName] <= maxValue; }; }; That’s it just pass in… Continue reading Angular JS Dynamic searching for a collection of objects, with min & max range (i.e., persons with age from 18 to 60)

Angular JS · Rails4 · Ruby On Rails

Angular JS implementation with Rails 4

Step 1 :¬†Create rails app using rails new employee_detailsStep 2 : Remove turbolinks gem from gemfile and add ‘pg’ gem for postgres. Set the rails version to 4.1.2 (Turbolinks may not work with angular js)Step 3 : Run bundle installStep 4 : Change database.yml to use postgresdevelopment: adapter: postgresql encoding: unicode database: employee_details username: postgres… Continue reading Angular JS implementation with Rails 4