angularjs-ng-repeat

AngularJS : How to pass data from directive to controllers function

大城市里の小女人 提交于 2019-12-20 11:33:28
问题 I'm trying to pass some data from directive into a function addTrackFromPicker in my controller. $scope.addTrackFromPicker = function (message) { console.log("addTrackFromPicker", message); }; Here what I have in my directive dir.directive('youtubeList', function($http, $timeout, YT_event){ return { restrict: 'E', scope: { search: '=', dial: '&' }, templateUrl: 'youtube-list.html', ... Here I want to call controllers function from my template and pass it item.id.$t as argument: <div class=

AngularJS - using ng-show within ng-repeat

試著忘記壹切 提交于 2019-12-20 11:13:10
问题 I'm having an issue using the ng-show directive within an ng-repeat block. The boolean value does not seem to be getting passed to ng-show correctly... To show what I mean, here is a screenshot of an example I made in JSFiddle: Here is some example markup: <table ng-controller="ActressController" class="table table-bordered table-striped"> <tr ng-repeat="actress in actressList"> <td> <span class="actress-name">{{ actress.name }}</span> <h4 ng-show="{ actress.name == 'Scarlett' }">Was in

nested ng-repeat $parent.$index and $index

邮差的信 提交于 2019-12-20 11:06:08
问题 I have a strange bug that, unfortunately, I cannot replicate with jsfiddle. I've commented out my entire code (Except libraries,etc) except for the following snippets. Is there something obvious that I don't understand? Any ideas? This works and prints: (0,0) (0,1) (1,0) (1,1) <div ng-repeat="i in list"> <div ng-repeat="j in list2"> <div> ({{$parent.$index}} {{$index}}) </div> </div> </div> However, this piece of code prints: (0,0) (1,1) (0,0) (1,1) <div ng-repeat="i in list"> <div ng-repeat=

AngularJS - multiple ng-click - event bubbling

夙愿已清 提交于 2019-12-20 10:59:52
问题 In the following example: <li ng-repeat="item in items" ng-click="showItem(item)"> <h3>{{item.title}}</h3> <button ng-click="remove(item)">Remove</button> </li> When I click on the button showItem() also is invoked due to event bubbling. I know that I can use $event to watch for $event.currentTarget and do $event.stopPropagation() etc. but this is very ugly. Btw. I don't want to stop propagation on the button (In my case the button is a twitter bootstrap dopdown/button - this is just an

How to avoid refreshing ng-repeat DOM list when array is updated

吃可爱长大的小学妹 提交于 2019-12-20 10:48:11
问题 I'm building a front-end to a mail-system. It's nicely split up in controllers and services. I'm using $interval to check for new mails, which gets received in JSON, and added to a model. Everything gets rendered nicely to the screen with checkboxes to choose mails for deletions and buttons etc... The problem is, that while a person is making choices - $interval will check for new mails, and replace the model-array with the incoming data, recreating the DOM and resetting all choices no matter

How to avoid refreshing ng-repeat DOM list when array is updated

强颜欢笑 提交于 2019-12-20 10:48:10
问题 I'm building a front-end to a mail-system. It's nicely split up in controllers and services. I'm using $interval to check for new mails, which gets received in JSON, and added to a model. Everything gets rendered nicely to the screen with checkboxes to choose mails for deletions and buttons etc... The problem is, that while a person is making choices - $interval will check for new mails, and replace the model-array with the incoming data, recreating the DOM and resetting all choices no matter

AngularJS - Format Text Return From JSON To Title Case

自作多情 提交于 2019-12-20 10:19:08
问题 I have a service that retrieves data from a JSON file. Some of the data within the data is all in uppercase, for example: $scope.FootballClubs = [{ CompanyName: [MANCHESTER UNITED, LIVERPOOL FOOTBALL CLUB, CHELSEA, WIGAN UNTIED, LEICESTER CITY] }]; And in my HTML, i am simply throwing about the above: <div ng-repeat="name in FootballClubs"> {{ name.CompanyName }} </div> Which throws out: MANCHESTER UNITED LIVERPOOL FOOTBALL CLUB CHELSEA WIGAN UNTIED LEICESTER CITY What i am trying to display

orderBy two fields (one in reverse)

只愿长相守 提交于 2019-12-20 10:16:37
问题 I would like to order a friend list by status (online firsts, offline lasts) and by alphabetical order. All I manage to get is: Online firsts / Reversed alphabetical order Or offline firsts / Alphabetical order Here is plunker to expose my problem 回答1: Change the orderBy filter to this: orderBy:['-status','name'] This will order by descending status (by prefixing the - character), then ascending name. Currently you're passing true to reverse the sort, which is causing the status to be correct

Avoid using extra DOM nodes when using nginclude

偶尔善良 提交于 2019-12-20 08:59:33
问题 I'm struggling to wrap my mind around how to have an ng-include not use an extra DOM element as I'm building an angular app from a plain-HTML demo. I'm working with pretty slim HTML with fully developed, tightly DOM-coupled CSS (built from SASS) and refactoring is something I want to avoid at all costs. Here's the actual code: <div id="wrapper"> <header ng-controller="HeaderController" data-ng-class="headerType" data-ng-include="'/templates/base/header.html'"> </header> <section ng-controller

AngularJS doesn't work with 'multiple' flag

无人久伴 提交于 2019-12-20 07:17:44
问题 I'm trying to filter some data from the select box. It works fine when I don't use the "multiple" flag. However, the idea here is to be able to select multiple environments and multiple applications and show it based the options I selected, but it is not working. I tried in many different ways, but I didn't find what I'm missing. Can someone help me here? Here are the files which I'm using. monitoring.html <div ng-controller="monitoring" class="md-padding selectdemoOptionGroups" ng-cloak=""