angularjs-ng-repeat

A directive to format phone number

爱⌒轻易说出口 提交于 2019-11-30 11:39:28
I was wondering how to automatically format a number in an input field using an angularjs directive? When I type in an input field say 6042919283 I want it to be shown as 604-291-9283. Thanks You could use UI Utils mask It allows you to define an allowd input format and will handle the validation for you as well as the formatting If your phone number is uniform i.e all the number is of digit 10 this one will work app.directive('formatPhone', [ function() { return { require: 'ngModel', restrict: 'A', link: function(scope, elem, attrs, ctrl, ngModel) { elem.add(phonenumber).on('keyup', function(

How can I animate the movement of remaining ng-repeat items when one is removed?

旧巷老猫 提交于 2019-11-30 11:38:57
I have a dynamic list of items using ng-repeat. When something happens an item may disappear. I have handled smoothly animating the removal of these items using ng-animate, but after they are gone, the remaining items simply snap to their new position. How can I animate this movement smoothly? I've tried applying an "all" transition to the repeated class and using ng-move with no success. You can achieve this by animating the max-height property. Check out this sample: http://jsfiddle.net/k4sR3/8/ You will need to pick a sufficiently high value for max-height (in my sample, I used 90px). When

Calling order of link function in nested and repeated angularjs directives

耗尽温柔 提交于 2019-11-30 11:28:07
问题 I'm fairly new to Javascript programming and I have only touched upon AngularJS. In order to evaluate it I decided to write a simple note application. The model is really simple, a list of notes where each note has a label, a text and a list of tags. However I ran into problem passing data between isolated scopes of nested directives. I have three directives, notes, note and tagger (defining new elements with the same names). Each of them using an isolated scope. The notes directive uses ng

angularjs: ng-repeat-start and ng-repeat-end with inner ng-repeat

陌路散爱 提交于 2019-11-30 11:18:37
Hi I have a simple use case for ng-repeat-start and end and is working just fine, the problem appears when I want to add an inner ng-repeat. Here is the my code <tr ng-repeat-start="obj in rows" > <td ng-repeat="e in obj.row">{{e}}</td> </tr> <tr ng-repeat-end> <td colspan="4">{{obj.description}}</td> <tr> The inner ng-repeat into td element is not working, I'm seeing the ngRepeat comment when I inspect the html source code, but the td elements are not being created. <!-- ngRepeat: e in obj.row --> My ugly workaround (given that I know the size of that vector) is: <tr ng-repeat-start="obj in

AngularJS: show loading HTML until data is loaded

空扰寡人 提交于 2019-11-30 10:30:54
问题 How do I have AngularJS show a loading spinner until the data has finished loading? If my controller has $scope.items = [{name: "One"}] set up statically, and an AJAX loader which populates $scope.items[0]['lateLoader'] = "Hello" , I'd like the spinner to show until the AJAX load is complete, and then populate the bound span with the retrieved data. <ul ng-repeat="item in items"> <li> <p>Always present: {{item.name}}</p> <p>Loads later: <span ng-bind="item.lateLoader"><i class="icon icon

AngularJS 'ng-filter' is very slow on array of ~1000 elements

扶醉桌前 提交于 2019-11-30 10:13:49
问题 I have a simple <input> search filter set up for a list of itemnames in AngularJS . My list looks like this: var uniqueLists = { category1: ['item1', 'item2', 'item3' ... 'item180' ], // Real list contains ~180 items category2: ['itemA', 'itemB', 'itemC' ... 'itemZZZ' ], // Real list contains ~1080 items category3: ['otheritem1', 'otheritem2', 'otheritem3' ] // Real list contains 6 items } I iterate through this list in Angular and print out the results in a <ul> for each category. <div ng

ng-repeat causing "Error: 10 $digest() iterations reached. Aborting! when passing scope to leaflet directive

喜夏-厌秋 提交于 2019-11-30 09:54:05
问题 Edited: After some advices i came back to old version of how i wanted handle angular and leaflet, link to fiddler but still is not working, Explanation: It was working with angular-leaflet-directive, but this directive has very bad performance on firefox, to compare leaflet.js self is very good so i thought i will try to make some small directive on my own, maybe somebody has some advices what is wrong and how to fix it? Link to fiddler: fiddler I try to pass result from ng-repeat to leaflet

ng-repeat is not updating when array is changed

五迷三道 提交于 2019-11-30 09:07:48
问题 I have an ng-repeat that isn't updating upon changing the data in the array that it is using. I've researched for quite a while but nothing seems to be working. Initially, when the page loads, the ng-repeat displays the first page of a dataset, upon getting new data (the next page) and setting that array with this data, the ng-repeat isn't noticing the change and never populates with the updated array. It would be greatly appreciated if someone could steer me in the right direction on this.

Improving nested ng-repeat + directive performance

有些话、适合烂在心里 提交于 2019-11-30 09:00:39
问题 I have a horizontal month calendar that shows the activities for employees per day. Currently it's using a table with the following hierarchy/flow 1) Controller: Generate an array containing every day for that month based on the select month / year. A $scope.$watchCollection updates the array whenever year or month changes. As the code explains what I do better: <table class="table table-bordered table-condensed" ng-controller="PlanningOverviewController"> <tr> <th><input type="text" ng-model

AngularJS ng-bind with a function

江枫思渺然 提交于 2019-11-30 08:04:57
问题 I want to show a table format for the Attachments section. I have the lookup and results data. Both have a common column of attachmentTypeId . I want to show the attachment category description based on the id. In the ng-bind I tried an attempt, it's not worked. I am using a function in the ng-bind , hope the approach is wrong, expect an alternate for the approach. The attachmentLookup contains the attachmentDesc , attachmentTypeId $scope.attachmentLookup = [{ "attachmentDesc": "Category One"