adding custom scripts with custom attributes in angular 6 projectHow to create angular 5 project in angular cli 6.0.1Could not find module “@angular-devkit/build-angular”Modify angular cli build to run custom scriptwhy default check attribute is not working in angular 6integrating bootstrap in angular X projectHow to read data attribute value in angular 6Custom directive is not working for angular 6:Add custom node Library Project to Angular ProjectAdd Custom Attribute to Request Header Angular 6Nested component calls in the angular project?

Should I hide continue button until tasks are completed?

Why is the voltage measurement of this circuit different when the switch is on?

How come I was asked by a CBP officer why I was in the US?

What kind of wire should I use to pigtail an outlet?

Could Sauron have read Tom Bombadil's mind if Tom had held the Palantir?

Do French speakers not use the subjunctive informally?

What do you call a weak person's act of taking on bigger opponents?

MH370 blackbox - is it still possible to retrieve data from it?

C-152 carb heat on before landing in hot weather?

Why is the Turkish president's surname spelt in Russian as Эрдоган, with г?

When is it ok to add filler to a story?

Why is C++ initial allocation so much larger than C's?

Peace Arch without exiting USA

Why do some professors with PhDs leave their professorships to teach high school?

When is the original BFGS algorithm still better than the Limited-Memory version?

STM Microcontroller burns every time

Change the boot order with no option in UEFI settings

Is adding a new player (or players) a DM decision, or a group decision?

Impossible darts scores

Distance Matrix (plugin) - QGIS

Employer wants to use my work email account after I quit, is this legal under German law? Is this a GDPR waiver?

Short and long term plans in a closed game in the Sicilian Defense

How to perform Login Authentication at the client-side?

Alphabet completion rate



adding custom scripts with custom attributes in angular 6 project


How to create angular 5 project in angular cli 6.0.1Could not find module “@angular-devkit/build-angular”Modify angular cli build to run custom scriptwhy default check attribute is not working in angular 6integrating bootstrap in angular X projectHow to read data attribute value in angular 6Custom directive is not working for angular 6:Add custom node Library Project to Angular ProjectAdd Custom Attribute to Request Header Angular 6Nested component calls in the angular project?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I need to add a script(cdn) in a component in my angular project.



on in it




// Start: for drop box
var dbx = new Dropbox( accessToken: 'A4fRBcFXasdkpAAAAAdgfdfgdfgAAAAAZBlQ9MJNe81yrTLOCioH-7Ty083asdEQSqTD97s7mLIJH0V', fetch: fetch );
dbx.filesListFolder( path: '' )
.then(function (response)
console.log(response);
)
.catch(function (error)
console.log(error);
);
// End: for dropbox```



addJsToElementDropbox(src: string, type: string, id: string, key: string): HTMLScriptElement 

let script:any = document.createElement('script');
script.type = type;
script.src = src;
script.id = id;
this.renderer.appendChild(document.body, script);
return script;

```


This is the script created in the DOM



<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs"></script>



My need is to create a script like this in DOM



<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="my-key"></script>










share|improve this question






























    1















    I need to add a script(cdn) in a component in my angular project.



    on in it




    // Start: for drop box
    var dbx = new Dropbox( accessToken: 'A4fRBcFXasdkpAAAAAdgfdfgdfgAAAAAZBlQ9MJNe81yrTLOCioH-7Ty083asdEQSqTD97s7mLIJH0V', fetch: fetch );
    dbx.filesListFolder( path: '' )
    .then(function (response)
    console.log(response);
    )
    .catch(function (error)
    console.log(error);
    );
    // End: for dropbox```



    addJsToElementDropbox(src: string, type: string, id: string, key: string): HTMLScriptElement 

    let script:any = document.createElement('script');
    script.type = type;
    script.src = src;
    script.id = id;
    this.renderer.appendChild(document.body, script);
    return script;

    ```


    This is the script created in the DOM



    <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs"></script>



    My need is to create a script like this in DOM



    <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="my-key"></script>










    share|improve this question


























      1












      1








      1








      I need to add a script(cdn) in a component in my angular project.



      on in it




      // Start: for drop box
      var dbx = new Dropbox( accessToken: 'A4fRBcFXasdkpAAAAAdgfdfgdfgAAAAAZBlQ9MJNe81yrTLOCioH-7Ty083asdEQSqTD97s7mLIJH0V', fetch: fetch );
      dbx.filesListFolder( path: '' )
      .then(function (response)
      console.log(response);
      )
      .catch(function (error)
      console.log(error);
      );
      // End: for dropbox```



      addJsToElementDropbox(src: string, type: string, id: string, key: string): HTMLScriptElement 

      let script:any = document.createElement('script');
      script.type = type;
      script.src = src;
      script.id = id;
      this.renderer.appendChild(document.body, script);
      return script;

      ```


      This is the script created in the DOM



      <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs"></script>



      My need is to create a script like this in DOM



      <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="my-key"></script>










      share|improve this question
















      I need to add a script(cdn) in a component in my angular project.



      on in it




      // Start: for drop box
      var dbx = new Dropbox( accessToken: 'A4fRBcFXasdkpAAAAAdgfdfgdfgAAAAAZBlQ9MJNe81yrTLOCioH-7Ty083asdEQSqTD97s7mLIJH0V', fetch: fetch );
      dbx.filesListFolder( path: '' )
      .then(function (response)
      console.log(response);
      )
      .catch(function (error)
      console.log(error);
      );
      // End: for dropbox```



      addJsToElementDropbox(src: string, type: string, id: string, key: string): HTMLScriptElement 

      let script:any = document.createElement('script');
      script.type = type;
      script.src = src;
      script.id = id;
      this.renderer.appendChild(document.body, script);
      return script;

      ```


      This is the script created in the DOM



      <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs"></script>



      My need is to create a script like this in DOM



      <script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="my-key"></script>







      angular6






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 10:13









      dpolicastro

      4473 silver badges9 bronze badges




      4473 silver badges9 bronze badges










      asked Mar 25 at 10:26









      Raru ChempazhanthyRaru Chempazhanthy

      276 bronze badges




      276 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          Use set attribute set custom attribute



          addJsToElement1(src: string, type: string): HTMLScriptElement 
          const script = document.createElement('script');
          script.setAttribute('data-app-key', 'Test');
          script.type = type;
          script.src = src;
          this.renderer.appendChild(document.body, script);
          return script;






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55335707%2fadding-custom-scripts-with-custom-attributes-in-angular-6-project%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            Use set attribute set custom attribute



            addJsToElement1(src: string, type: string): HTMLScriptElement 
            const script = document.createElement('script');
            script.setAttribute('data-app-key', 'Test');
            script.type = type;
            script.src = src;
            this.renderer.appendChild(document.body, script);
            return script;






            share|improve this answer



























              1














              Use set attribute set custom attribute



              addJsToElement1(src: string, type: string): HTMLScriptElement 
              const script = document.createElement('script');
              script.setAttribute('data-app-key', 'Test');
              script.type = type;
              script.src = src;
              this.renderer.appendChild(document.body, script);
              return script;






              share|improve this answer

























                1












                1








                1







                Use set attribute set custom attribute



                addJsToElement1(src: string, type: string): HTMLScriptElement 
                const script = document.createElement('script');
                script.setAttribute('data-app-key', 'Test');
                script.type = type;
                script.src = src;
                this.renderer.appendChild(document.body, script);
                return script;






                share|improve this answer













                Use set attribute set custom attribute



                addJsToElement1(src: string, type: string): HTMLScriptElement 
                const script = document.createElement('script');
                script.setAttribute('data-app-key', 'Test');
                script.type = type;
                script.src = src;
                this.renderer.appendChild(document.body, script);
                return script;







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 12:34









                VishnudasVishnudas

                665 bronze badges




                665 bronze badges





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55335707%2fadding-custom-scripts-with-custom-attributes-in-angular-6-project%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript