Skip to main content

How can I select an index from an HTMLCollection in Ionic?

I want to select all .message-wrapper elements that I generate in my page

{{ chat.chat_lines[key].text }}

When I select the .message-wrapper it returns me an HTMLCollection, but I can't access its child

let messages = this.element.nativeElement.getElementsByClassName("message-wrapper");
console.log(messages); // Returns HTMLCollection
console.log(messages[0]); // Returns null

Comments

Popular posts from this blog

Select distinct count after count?

I'll cut right to the chase: I have a select I'm currently writing with a rather lengthy where clause, what I want to do is calculate percentages. So what I need is the count of all results and then my each distinct counts. SELECT distinct count(*) FROM mytable WHERE mywhereclause ORDER BY columnIuseInWhereClause works fine for getting each individual values, but I want to avoid doing something like Select (Select count(*) from mytable WHERE mywhereclause), distinct count(*) FROM mytable WHERE mywhereclause because I'd be using the same where-clause twice which just seems unnecessary. This is for OracleDB but I'm only using standard SQL syntax, nothing database specific if I can help it. Thanks for any ideas. Edit: Sample Data __ID__,__someValue__ 1 | A 2 | A 3 | B 4 | C I want the occurances of A, B, C as numbers as well as the overall count. __CountAll__,__ACounts__,__BCounts__,__CCounts__...

Conditional remove/disable/hide select list option based on another select list. All browser support required

HTML Module Account User Send me an alert when my balance... when my login... So this is existing code that someone else worked on and is no longer a resource. This little sample just changes the second select list based on the selected item in the first select list. This works just fine in FF and Chrome and after some digging I've been told that one can not hide options in a select list in IE. I've also read up on this question here but still drawing up short on getting it working for IE. Can anyone advise? Thanks. jsfiddle Solved remove instead of hide as shown in the linked post seems to work in IE. Another possible implementation is to empty the option list and add only the option s in question: var alertselect, modselect, orgalerts; var showAlerts = function (module) { alertselect.empty().append( orgalerts.filter(function () { return $(this).data('params').module === module; })); }; Of cours...

rails 4 asset pipeline vendor assets images are not being precompiled

I'm using rails 4 & ruby 1.9.3 for my application and fancybox2-rails gem, but there's a general problem with asset pipeline. If I run rake task for precompile, then everything is fine except for images in vendor/assets/images and ../gems/ruby-1.9.3-p327/gems/fancybox2-rails-0.2.1/vendor/assets/images . Images from these two folders are not being precompiled and eventually I have a problem with dead links to non-existing images. Any suggestions? Solved It seems like images are included by default only from app/assets folder. So the solution is to add this line to config/application.rb config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif) It sounds Sporker can't autoload images from vendor/assets/images. 2.2 Asset Organization Pipeline assets can be placed inside an application in one of three locations: app/assets, lib/assets or vendor/assets. app/assets is for assets that are owned by the application, such as custom imag...