angularjs-ng-repeat

Add new text box on click of a button in angular js

不想你离开。 提交于 2019-12-02 03:33:43
How do I add new text box when submit button is pushed. This is what I have tried and I know there's some thing wrong. I am still new to angular js. Example: <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example - example-ngController-production</title> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script> <script> angular.module('controllerAsExample', []).controller('SettingsController1', function ($scope) { $scope.contacts=[] $scope.addContact = function() { $scope.contact.push({$scope.contact}) } }); }; </script> </head> <body ng-app=

AngularJs Directive to add Attributes, the events are not triggered

我的梦境 提交于 2019-12-02 03:24:30
Good morning everybody, I'm a bit stuck on this directive, what I want is to receive a JSON string from the getProperties function like: {"class":"someclass","ng-change":"someChange()",ng-click": "someCLick()"} The directive will create all the attributes present in the JSON(and it works), the problem is the ng-* doesn't work at all.... any ideas?? HTML: <div ng-repeat="field in fields"> <input type="text" ng-model="ngModel[field.fieldName]" ng-switch="text" property="{{formParams.getProperties(field.fieldName)}}" update-attr /> </div> This is the directive: .directive('updateAttr', function (

AngularJs Directive to add Attributes, the events are not triggered

天大地大妈咪最大 提交于 2019-12-02 03:19:41
问题 Good morning everybody, I'm a bit stuck on this directive, what I want is to receive a JSON string from the getProperties function like: {"class":"someclass","ng-change":"someChange()",ng-click": "someCLick()"} The directive will create all the attributes present in the JSON(and it works), the problem is the ng-* doesn't work at all.... any ideas?? HTML: <div ng-repeat="field in fields"> <input type="text" ng-model="ngModel[field.fieldName]" ng-switch="text" property="{{formParams

ng-selected is not working with ng-model in select box - Angularjs [duplicate]

核能气质少年 提交于 2019-12-02 00:05:08
This question already has an answer here: AngularJS: ng-selected doesn't show selected value [duplicate] 2 answers While ng-model is used in select box and ng-selected is also used in options with some condition that time ng-selected is not working. If I will remove ng-model than ng-selected is working, but if i will remove ng-model than how I should get the value of select box in controller. Please help ! Here is my code... HTML: <select class="form-control" ng-change="accessModeSelected()"> <option ng-selected="mode.status == '1'" ng-repeat="mode in storageResult.accessMode" ng-value="mode

How to select dynamically generated elements from inside an AngularJS directive?

放肆的年华 提交于 2019-12-01 21:46:24
问题 In my directive, I need to select out certain DOM elements, some of which are generated dynamically in an ng-repeat loop. If I do it in a straightforward way, I will only get the static elements. However, if I delay the selection by, say, 500ms, I will get all elements, which is what I want. Although this works, it is not an ideal solution, and certainly doesn't seem like best practise. On the one hand, you'd like to keep the timeout as short as possible, but on the other hand, you want to be

checkbox unchecking itself after angularjs filter applied

扶醉桌前 提交于 2019-12-01 21:04:41
This causes the same item to be added to the array - which is used for querying - potentially twice. When the modal is closed and opened again and filtering is not used, everything is fine (this is because my modals are simply within the HTML, I just ng-hide them on click). When an item which has already been added, but its checkmark has been lost due to filtering, is checked again two of the same items are added. When it is unchecked both are removed, unless it is the last item in the array, this cannot be removed (I'm aware this is my slapdash logic). Below is the relevant HTML and

ng-scrollbar is not working with ng-repeat

北城以北 提交于 2019-12-01 21:01:13
In my app I want to use a custom scrollbar for a div. So I used ng-scrollbar, it is working fine with static data. But whenever I get the data using ng-repeat it is not working. Please help me in this regard. Thanks in advance. myFile.html <style> .scrollme { max-height: 300px; } </style> <div ng-app="myapp"> <div class="container" ng-controller="myctrl"> <button class="btn btn-info" ng-click="add();">add</button> <button class="btn btn-warning" ng-click="remove();">remove</button> <div class="well" > <div class="scrollme" ng-scrollbar bottom rebuild-on="rebuild:me"> <h1>Scroll me down!</h1>

All checkboxes get checked when one is checked (should be just the one checked) - inputs generated with angular js

一曲冷凌霜 提交于 2019-12-01 20:55:53
I am making app with angular js. It goes like this. User creates groups and adds group names User creates 'websites' and for each website he can check groups that are created in previous step Problem is that all groups checkboxes get checked when he checks just one. Here is the code that generates the checkboxes: <p>Groups: <label ng-repeat='group in groups'> <input type="checkbox" ng-model="newSite.groups" name="group-check" value="{{group.id}}"/> {{group.name}}</label></p> Here is the code that is outputed: <label ng-repeat="group in groups" class="ng-scope ng-binding"> <input type="checkbox

How to flatten with ng-repeat

扶醉桌前 提交于 2019-12-01 18:44:12
I have: businesses: [ {businessName: 'A', "address":[loc1, loc2, loc3]}, {businessName: 'B', "address":[loc1, loc2]}, {businessName: 'C', "address":[loc1]} }; I want to ng-repeat this object with output: A | street, city, zip, state A | street, city, zip, state A | street, city, zip, state B | street, city, zip, state B | street, city, zip, state C | street, city, zip, state In other words, i want to display this object as flat in a table with ng-repeat. Do i have to flatten it myself, or does ng-repeat have the power to do this? Ideally i could just do something like ng-repeat business in

modelling data from rows to columns in Angular dynamically

孤街醉人 提交于 2019-12-01 14:29:04
I have data that looks like this: $scope.items =[{name: "item1", year : "2013", value : "100"}, {name: "item1", year : "2012", value : "97"}, {name: "item1", year : "2011", value : "98" }, {name: "item2", year : "2013", value : "-7" }, {name: "item2", year : "2012", value : "-6" }, {name: "item2", year : "2011", value : "-5" }, {name: "item3", year : "2013", value : "93" }, {name: "item3", year : "2013", value : "91" }, {name: "item3", year : "2012", value : "93" }, {name: "item4", year : "2013", value : "-35" }, {name: "item4", year : "2012", value : "-36" }, {name: "item4", year : "2011",