A simple javascript file is running absolute fine, But when I try to insert those code in angular (from assets OR inserting code in index.html file) giving unexpected value.
HTML code
<p class='collect'> this is text </p>
<p class='collect'> this is text </p>
<p class='collect'> this is text </p>
//js in separate file
var all = document.getElementsByClassName('collect');
console.log(all.length);
//returns 3
//js code in angular
var all = document.getElementsByClassName('collect');
console.log(all);
// returns
HTMLCollection []
length: 3
0: p.collect
1: p.collect
2: p.collect
// but in
console.log(all.length);
// returns 0