Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 229122

Performance of functions in HTML template

$
0
0

Hello there,
i want the texts within my HTML pages to be fully dynamical.
For that, i have an object which contains the strings i loaded from my webserver.
Normally, i would apply the text with something like this:

<p>{{object.text1}}</p>

But i would like to wrap this into a function, so i can track, if some string is missing and report that back to my webserver, so i cann fill it there.
So, i plan, to do the following:

<p>{{getText('text1')}}</p>

And in my controller something like this:

function getText(name){
   if(object[name]){
      return object[name];
   }
   //handle the missing string
}

In my first tests whit the second solution i saw, that getText() is called multiple times (up to 10 times and more). So i was wondering, how expensive is the function compared to the direct acces to the variable?
Can anyone give me some information an that?

Thank you

best regards
Skee


Viewing all articles
Browse latest Browse all 229122

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>