javascript - How to remove "http://" from domain name inside view -


how can remove "http://" beginning of url inside view in angularjs app?

i have urls in database like:

http://example.com/ http://example.com example.com 

but need show

example.com 

inside view.

this deals http , https or other url. uses built-in url class, handle of things haven't thought of correctly.

  app.filter('domain', function () {     return function (input) {       try {         var url = new url(input);         return url.hostname;       } catch (domexception) {         // malformed url. return original (or else).         return input; }       };     }); 

urls correct , might not have thought of:

you may not need them now, using correct library function means app won't break unexpectedly in future when tries use else.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -