0

I'm working in angular right now. I have 2 js files in index.html, the thing is i want to load one for user A and other for user B in a dynamic manner! How can it be achieved?

Thanks in advance!

VinoPravin
  • 947
  • 3
  • 17
  • 32
  • duplicate of this http://stackoverflow.com/questions/15939913/single-page-application-load-js-file-dynamically-based-on-partial-view – Gaurav Kumar Singh Mar 22 '17 at 13:02
  • Possible duplicate of [Single page application - load js file dynamically based on partial view](http://stackoverflow.com/questions/15939913/single-page-application-load-js-file-dynamically-based-on-partial-view) – Gaurav Kumar Singh Mar 22 '17 at 13:02

1 Answers1

0
if(userA){
    var file = document.createElement('script')
    file.setAttribute("type","text/javascript")
    file.setAttribute("src", file1)
 }else if(userB){
    var file = document.createElement('script')
    file.setAttribute("type","text/javascript")
    file.setAttribute("src", file2)
 }
Pramod_Para
  • 671
  • 3
  • 10