angularjs-ng-repeat

AngularJs pass instance of each ng-repeat in HTML to directive

孤街醉人 提交于 2019-12-04 06:15:17
I'm thinking this should be simple but I'm missing something. How can I pass a flowObj in my ng-repeat below to my Directive? I want to pass it to my directive then on click use that FlowObj then apply some logic. I tried using the commented code in my directive scope: { test:"@" } But it seems to screw up my css . HTML: <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body> <div id="center_outer"> <div id="center_inner" ng-controller="CtrlPageFlow"> <div flowclick class="cflow" ng-repeat="flowObj in flows" > {{flowObj.name}} </div> <

Can I use Angular variables as the source of an audio tag?

蓝咒 提交于 2019-12-04 06:05:08
I am trying to do the following: <div ng-repeat="audio in event.audios"> <audio ng-src="/data/media/{{audio}}" controls></audio> </div> But when I load the view, the {{audio}} variable is not parsed but hardcoded into the source as is. However, if for example, I place that same variable outside of the audio tag it renders the name of the audio file correctly. I've tried using both src and ng-src to no avail. Is there a way to get the variable to work within an audio tag? Thanks in advance. theJoeBiz I'm not all that familiar with the ngSrc directive outside of using it on images, but it might

Angular checkbox filtering data list

◇◆丶佛笑我妖孽 提交于 2019-12-04 06:02:18
问题 Seen a few options for filtering data via checkboxes but it all seems fairly overly complicated for something I'd expect Angular to do easily. Take a nose at http://plnkr.co/edit/Gog4qkLKxeH7x3EnBT0i So there are a few filters in place here but the ones I'm interested in are the checkboxes. Using a pretty nifty Angular UI module I found called Unique, it lists the different types of providers and rather than repeating them, just lists one of each type. Lovely stuff. However I can't get that

:first-child with ng-repeat

时光总嘲笑我的痴心妄想 提交于 2019-12-04 05:29:52
I have an ng-repeat and only want to apply a style to the first div with the class type in the ng-repeat. <div class="my-list" ng-repeat="item in list"> <div class="type"> <span>{{item.label}}</span> </div> <div class="check"> <span>{{item.ischecked}}</span> </div> </div> I have tried the following but it applied the CSS to all the divs with a class of type .my-list .type:first-child You can use $first , that indicates the first iteration within a ng-repeat . <div class="my-list" ng-repeat="item in list"> <div class="type" ng-class="{myClass:$first}"> <span>{{item.label}}</span> </div> <div

Filter array of objects by attribute with integer value in ng-repeat

假装没事ソ 提交于 2019-12-04 04:12:47
I have the directive like this ng-repeat="place in tb_places | filter:{'id':inputID}" to output some array of objects looks like this $scope.tb_places = [ {name: 'some1', id:1} ... {name: 'some10', id:10} {name: 'some11', id:11} {name: 'some12', id:12} ... ] when i change the inputID and set it equal to 1, the result array fills with elements of source array with 'ids' of 1 and 10,11,12. Thus, the part of 'id' value is checked like substrings, not a numbers. How can i cure it? thanks! UPD i've tried to add ":true" in filter expression - it completely clears output (result array), It works for

How to pass multiple parameter in angular filter function, not custom filter

你。 提交于 2019-12-04 02:57:12
I tried hard and visit lot of similar question like this but still unable to solve this issue. I want to pass extra parameter in angular filter function. I found solution as below but it's not working. I am getting undefined for object which I have used in ng-repeat . <li ng-repeat="user in users | filter:isStatus(user,secondParam)">{{user.name}}</li> There are solution for angular custom filter as below but that also not working with angular filter function. <li ng-repeat="user in users | filter:isStatus:user:secondParam">{{user.name}}</li> jsFiddle - You can see my problem here. Will try:

Split for ng repeat item?

二次信任 提交于 2019-12-04 02:20:32
Simple question- if I have this in my controller: $scope.somedata = 'Item 1, Item 2'; // set from something else is there a way to split somedata for my view in a ngRepeat expression? Something like: <div ng-repeat="item in somedata | split(',')">{{item}}</div> which doesnt work... Or do I have to do $scope.somedata = 'Item 1, Item 2'; // set from something else $scope.items = somedata.split(','); and then <div ng-repeat="item in items>{{item}}</div> I think I'm not really understanding what I can do in an expression in AngularJS. The string the right of the | is resolved to the name of a

Recursive custom directives using ngRepeat

家住魔仙堡 提交于 2019-12-04 02:07:24
I'm trying to create a treeview using AngularJS. Here's my code: module.directive('treeview', function () { return { restrict: 'E', templateUrl: "/templates/ui/controls/treeview.htm", replace: true, transclude: true, scope: {}, link: function (scope, element, attrs) { console.log("treeview directive loaded"); }, controller: function ($scope, $rootScope) { $rootScope.depth = 0; $scope.items = [ { text: "face" }, { text: "palm" }, { text: "cake", childitems: [ { text: "1 face" }, { text: "1 palm" }, { text: "1 cake" } ] } ]; } }; }); module.directive('treeviewItem', function () { return {

AngularJS: ng-repeat with key value - updating object

不想你离开。 提交于 2019-12-04 01:55:27
I am rendering key:value object array with ng-repeat like this: <div ng-controller="mainCtrl"> <div ng-repeat="record in records"> <div ng-repeat="(key, value) in record"> <input ng-model="key" />: <input ng-model="value" /> </div> </div> </div> JS: var mainCtrl = function($scope){ $scope.records = [ {'key1':'val1'}, {'key2':'val2'} ]; } Problem is that keys and values cannot be updated through input tags. For some reason it becomes one way binding after making ng-repeat iterate over (key,value). Fiddle: http://jsfiddle.net/BSbqU/1/ How can I make it a two way binding? Or should I approach

Angularjs: ng-bind-html & ng-repeat

China☆狼群 提交于 2019-12-04 01:40:46
问题 I have a views that i am updating after I retrieve them from the database for this template: <div class="row" ng-repeat="post in posts"> <div class="col-lg-9 col-lg-offset-2"> <!-- blog entry --> <br ng-hide="$last"> <h1><a href="{{'#/post/' + post.title}}">{{post.title}} </a></h1> <p><span class="glyphicon glyphicon-time"></span> Posted on {{ post.time_Date | date:'MM/dd/yyyy @ h:mma'}} </p> <div class="image_Center"> <!-- <img ng-src="{{post.imageUrl}}" width="550" height="450"> --> <img ng