Search Posts

Getting error @types/tapable/index"’ is not a constructor function type

My production website was working perfectly. but after putting “npm install” command on server then trying to build using “npm run build:prod” command. facing below error. ERROR in [at-loader] node_modules/@types/tapable/index.d.ts:290:30 TS2314: Generic type ‘HookMapInterceptor<T1, any, T2, T3>’ requires 4 type argument(s). ERROR in [at-loader] node_modules/@types/tapable/index.d.ts:293:38 TS2368: Type parameter name cannot be ‘any’ ERROR in [at-loader] node_modules/@types/tapable/index.d.ts:293:48 TS2300: Duplicate identifier ‘any’. I tried this command “npm install @types/[email protected]”. but did not resolve the issue. please help […]

Mocha 5.1.1 is not testing all files

I upgraded mocha from ^2.2.5 to 5.1.1 in my Angular JS project. I have 11550 test cases in my application, all of which were successful before the upgrade. However, after upgrading Mocha, I’m getting irregular outputs while running grunt test such as Firefox 60.0.0 (Windows 10.0.0): Executed 6132 of 11550 (skipped 86) SUCCESS (3 mins 13.945 secs / 16.863 secs) TOTAL: 6132 SUCCESS Firefox 60.0.0 (Windows 10.0.0): Executed 868 of 11550 (skipped 9) SUCCESS (35.564 […]

How to order a dictionary by value in AngularJS

I’ve a REST api that returns the list of locales as dictionary: { “en-uk”: “English UK”, “en-us”: “English USA”, … } This dictionary is correctly ordered alphabetically by value. When AngularJS receives it via HTTP, the dictionary gets automatically re-sorted by key, so when I bind to a select element the list of options is ordered by key, and the alphabetical order by key doesn’t match the one by value, I get a wrong sorting. […]

How to create singleton service for timer in angularjs?

I am doing a project in angularjs (1.x). My requirement is that I need to count the number of seconds elapsed. For that, I have written a code using $interval service in my controller which is working perfectly fine. Now , since this code is shared by many objects, so I thought to make it singleton. How can we do so? Below is my code inside controller: scope.timeDiff = 0; var intervalId = $interval(function(){ scope.timeDiff […]

Filter Search AngularJS

I want to filter in search my catalogs json, but my code doesn’t work, here is code : <input type=”text” style=”width:275px;margin-top:5px;” class=”form-control form-control-sm form-control-rounded” placeholder=”Search…” ng-model=”search”> <br /> <br /> <div class=”panel-body”> <div class=”cui-ecommerce–catalog”> <div class=”row”> <div ng-repeat=”(name, text) in textures | filter:search”> <div ng-repeat=”url in text”> <div> {{url.url}} <a href=”javascript: void(0);” style=”cursor:default;”> <img ng-src=”{{url.url }}” /> </a> </div> </div> </div> </div> </div> </div> And my plunker : https://plnkr.co/edit/30nyExfhnLWy35p906CJ?p=preview Thanks for answers in advance!!! Source: […]

How do I do some action after ng-if, ng-show etc happens in AngularJS?

I am working on a workaround using position: absolute that needs the position of a div to be calculated. <html> <!– this iframe will positioned by an angular partial through a directive –> <iframe style=”position: absolute; width: 400px; height: 400px”;></iframe> <div id=”angular”></div> <html> It works fine for static partials like this: <div id=”dummy” style=”width: 400px; height: 400px;”></div> <reposition></reposition> but for dynamic partials that have ng-if or ng-show it won’t work because the calculated positions will […]

Unable to send sign up data from front-end to backend

I am trying to make an HTTP request from AngularJs to Nodejs. The error I am getting is: Failed to load localhost:4000/Register: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https. Code for my http request: $scope.sendData=function () { var dataObj = { fname : $scope.user.fname, lname : $scope.user.lname }; var myJSON = JSON.stringify(dataObj); var request = $http({ method: “post”, url: “localhost:4000/Register”, headers: { “Access-Control-Allow-Origin”: “*”, “Access-Control-Allow-Methods”: “GET, POST, PUT, […]

Javascript: Download XML file from an XML string [on hold]

I have a problem and I feel like I should know how to solve this and yet somehow I do not. Anyhow, here it is: In a modern cross-browser way, using plain Javascript (jQuery or AngularJS 1.6+ is allowed, but not preferred) on a button click take a string of XML like: “<?xml version=”1.0″ encoding=”UTF-8″?><YEP>….etc.” Create an xml file off this XML string to download immediately. Any help is appreciated. Source: AngularJS

Difference between elem and elem[0] in angularJS custom directives?

angular.module(‘todomvc’) .directive(‘todoFocus’, function ($timeout) { ‘use strict’; return function (scope, elem, attrs) { scope.$watch(attrs.todoFocus, function () { $timeout(function () { elem[0].focus(); }, 0, false); }); }; }); I was analyzing a custom directive of a JS sample code (angularJS) lately and I came across this line which frustrated me. elem[0].focus(); When I tried to change elem[0].focus(); to elem.focus(); The whole directive just doesn’t work. But in my previous attempt to create a custom directive that […]

AngularJS – Unable to get data from service

In an attempt to resolve a problem synchronizing between controllers. I was trying to follow the solution provided here: https://www.codementor.io/justinobney/keeping-angular-service-list-data-in-sync-with-controllers-a2hlwgwva For some reason with my setup this doesn’t seem to work for me. My controllers are returning either empty or its just simply not working. Would anyone know why this approach wouldn’t work? Main controller: GDI_App.controller(‘Form_Controller’, function ($scope, Service) { Service.get_data(); //What I tried so far: $scope.Current.incidents = Service.Current.data; //returns nothing. $scope.Current.incidents = Service.current_data(); //returns […]

Next Page » « Previous Page