Loopback Login a user with REST as datasource

Issue I have a UserModel that has a base model USER and a REST datasource “UserModel”: { “dataSource”: “mock”, “public”: true } Data Source “mock”: { “name”: “mock”, “baseURL”: “http://localhost:3000/”, “connector”: “rest” }, The UserModel { “name”: “UserModel”, “base”: “User”,

Continue reading

LoopBack filter "where and " return wrong/same result in any value

Issue This is what in loopback docs said about using and operators rest: ?filter[where][and][0][title]=My%20Post&filter[where][and][1][content]=Hello I tried: count?filter{“where”:[{“and”}[{“user_id”:”5a6840ddb2b58b07cca3c680″},{“post_id”:”4444″}]} //post_id:4444 is not exit and count?filter[where][and][0][user_id]=”5a6840ddb2b58b07cca3c680″&filter[where][and][1][post_id]=”5a6253bdcf975122dcf11dd8″ and many other forms but the result is count: 12 but should return 0 in 4444 or

Continue reading

AngularJS REST resource – refresh query

Issue How can I refresh query result of $resource in AngularJS without refreshing the page? My page: <div class=”container” ng-controller=”AppController”> <div ng-repeat=”tile in items”> <p>{{tile.name}}</p> </div> <button ng-click=’??’> Reload tiles </button> </div> Controller: (function(angular) { var AppController = function($scope, Item)

Continue reading

Using $resource with rest service

Issue I’m trying to get familiar with $resource in order to use RESTful Web Services. So, for the attempt, I declared a factory like this : ‘use strict’; angular.module(‘BalrogApp’).factory(‘Req’, [‘$resource’, function($resource) { return $resource(‘http://localhost:8000/api/catalog/requests/:id’, {id: ‘@id’}, { ‘update’: { method:

Continue reading

angularjs DELETE array of objects

Issue Please help me understand: why angularjs not delete array of objects $scope.removeAll = function( all = _.pluck($scope.uploader.queue, ‘file’); all.length && HTTPStorage.query_delete(all, function () { $scope.uploader.clearQueue(); delay.resolve(); }); ) service: services.factory(‘HTTPStorage’, [‘$resource’, function($resource){ return $resource(‘/api/v1/documents/storage/:id’, {‘id’: ‘@id’},{ ‘query_delete’: { method:

Continue reading

How to pass body payload to angular $resource DELETE call

Issue I have standard angular $resource configured as such angular.module(‘client.resources’) .factory(‘ProjectSubjectResource’,[‘$resource’, function ($resource) { release: { method: ‘DELETE’, isArray: false } }); }]); and I am calling this method as ProjectSubjectResource.release({projectId: projectId, subjectId: 0},{ subjectIds: subjectIdArray}) where subjectIdArray is array

Continue reading

"bound m" show in angular ng-repeat

Issue I use restangular to connect to REST API. I define a ProductService.js with this code: ‘use strict’; angular.module(‘app’).service(‘ProductService’, function($rootScope, Restangular) { // Build collection /product URL var _productService = Restangular.all(‘product’); this.list = function() { // GET /api/product return _productService.getList();

Continue reading

Catching errors in Angular HttpClient

Issue I have a data service that looks like this: @Injectable() export class DataService { baseUrl = ‘http://localhost’ constructor( private httpClient: HttpClient) { } get(url, params): Promise<Object> { return this.sendRequest(this.baseUrl + url, ‘get’, null, params) .map((res) => { return res

Continue reading

I get colon with my param using express for node.js

Issue Here’s my routing : router.route(‘/search:word’).get(function(req, res) { var re = new RegExp(req.params.word, ‘i’); console.log(req.params.word); Place.find().or([{ ‘title’: { $regex: re }}, { ‘category’: { $regex: re }}]).sort(‘title’).exec(function(err, places) { res.json(JSON.stringify(places)); }); }); When I use the request /places/search:test the console

Continue reading