Search Posts

Category: angular1.6

`$location` causes page to hang after redirect with `$http` Interceptor?

Can anyone help me understand why my authInterceptor, upon a 401 or 500 error, redirects OK (using $location) but the page seems to hang aftewards, and the response does not seem completed? Does sending back $q.reject(rejection) in the code below complete the request? What am I doing wrong? Note: this project is using Angular v1.6.2 app.factory(‘authInterceptor’, function($q, tokenService, $location) { return { request: function(config) { token = tokenService.getToken(); if (token) { // If token, send […]

How to enable backspace on autocomplete field angular

I have some autocomplete fields in a form that doesn’t clear the text when backspace key is pressed. I need to enable the backspace function but i dont know anything about angular js and i haven’t find anything helpful online for this case. Autocomplete is defined in a file that is called angular-material.js .Angular is version 1.6 Here is the html side of the field: <md-autocomplete flex required ng-disabled=”ctrl.isDisabled” md-no-cache=”ctrl.noCache” md-selected-item=”ctrl.selectedProvince” md-search-text=”ctrl.searchTextProvince” md-items=”item in ctrl.queryProvince(ctrl.searchTextProvince)” […]

Angular (1.x) filter not working with array of objects

I am trying to take input a search term like so: <div class=”form-group”> <input type=”text” class=”form-control” ng-model=”” placeholder=”Enter search term”> </div> And then using this search term as filter on an array of objects being rendered using ng-repeat, like so: <tbody> <tr ng-repeat=”p in vm.items track by $index | filter:”> <td><a>{{p.uid}}</a></td> <td>{{p.em}}</td> <td>{{p.ct | date:’medium’}}</td> </tr> </tbody> But in the developer’s console, I am getting the following error: dashboard-js-bundle.min.js:117 Error: [filter:notarray] at dashboard-js-bundle.min.js:6 […]

Why does my angular1.6 controller not bind correctly when I have a break point

HB.Core.Directives.directive(‘hbMultiselect’, [ function() { return { restrict: ‘E’, templateUrl: ‘/hb-core/library/directives/hb-multiselect/hb-multiselect-ptl.html’, scope: {}, controllerAs: ‘$ctrl’, bindToController: { optionsData: ‘<‘, optionsSelected: ‘=’, allSubtypesSelected: ‘=’ }, controller: function() { var $ctrl = this; // $ctrl.$onInit = function() { // console.log(this); // Tried this… didn’t work either // }; function init() { $ctrl.isExpanded = false; $ctrl.optionsDisplay = []; $ctrl.tags = []; console.log(“——“) console.log($ctrl); console.log(“——“) >>>>>>>>>>>>>>>>>>>>**BREAK POINT HERE** } init(); } }; } ]); When I run the code without […]