Search Posts

Category: dom

AngularJS change currency display by manipulating the $locale

So I’m struggling with this issue for some time now and yet I couldn’t find an answer. Basically I’ve this: const formattedCurrency = $filter(‘currency’)(input); This returns me something like this $0.00 ($ seem to be the default angular curency CURRENCY_SYM:”$”) What I want to achieve is to make this return not $0.00but a dynamic currency, for example €0.00 or £0.00. So let’s assume that I have a html page with this text: I have $0.00 […]

Cannot bind event callbacks on DOM objects under a directive’s DOM element

I’m currently trying to refactor some very simple AngularJS code to move all functionality under a top-level directive. A parent element is given the directive, the directive binds the ‘mousemove’ event to that element, then goes through each child with a particular ID and binds ‘mousedown’ and ‘mouseup’ event callbacks to it. angular.module(‘DataStructureVisualizer’). directive(‘dragDrop’, function () { return { link: function ($scope, element, attrs) { var mouseLocX = 0; var mouseLocY = 0; var isElementHeldDown […]

Angular4: Create a Directive to Show a Profile card on Hover

For reference you can visit Twitter and hover a Profile name. That is what i’m trying to achieve. The Hover card does show correctly, But i’ve to add the ng-template each and everywhere I’ve to have this feature <div profilePeek class=”user-name cursor” (click)=”redirectProfile(item.type,item.id)”>{{ getProfileData(item.type, item.id).name }} <ng-template #preview> <app-hover-profile [type]=”item.type” [key]=”item.id”></app-hover-profile> </ng-template> </div> Can this be included in the Directive as well. Im pretty new to directives, so please guide if this is a blunder. […]

Appending a list iterating in AngularJS to the HTML DOM

So I have an AngularJS function that when called should add a list element to a div in the DOM, and the list should be ng-repeat so that it could iterate on objects from a list. These objects in the list contain a few properties which I want to print out. Part of the AngularJS program var el = angular.element(document.getElementById(‘categories’)); el.append(‘<ul id=”‘ + categoryItemStr + ‘”><li ng-repeat=”item in categories[currentCategory]”><h4 class=”h4″>{{item.itemName}}</h4>{{item.itemDescription}}<br><span style=”font-size:11px;”>{{item.itemPrice}}.00 $</span></li></ul>’); But when I […]

Integrate Mapzen with Angular-Leaflet-Directive

Trying to integrate Mapzen’s geocoding services which provides a method to autocomplete location searches, with the Angular-Leaflet-Directive. I’m quite new to Angular, and don’t know how it all works yet, so I’ve probably not set everything up straight. The map works and all that, but when I add the map variable for the Mapzen-service, I get this error-message: Uncaught Error: Map container not found. I’m guessing it either has to do with the variable not […]