Thank you mate! worked here!!! I was strougling cause I've never worked with Angular before, I accepted a job that requires this framework and I didn't knew why my script wasn't working. Thank you so much!
Hello, bro! You best, you helped me solve a problem! You video helped me understand how to include my file.js when I go from one page to two, that works my file.js! Thank you, bro!
The point is WE NEES TO RESTART TRH SERVER. I tried many, but didn't work any for me.. If the code is not working, please restart the server... Great Vdo😀🙌
Hello I have a question, in timestamp 2:12 what if you have more than one local js file how are you going to include them or even the external js file that is not in your local project
Hello sir I did exactly as you did in the video. However, I can't access elements using document.querySelector or document.querySelectorAll. Only alert and console.log work but the JS file can't access the html elements inside my component. Please provide help
Let's say you have a deployed script you'd want to fetch and execute, e.g. a custom script for enhancing application functionality I.e. extensibility, how would you do that?
@@louisyan135 Yeah, so in my use case, customers can create scripts themself to extend/customize the application, e.g disabling a form field they wish never to be enabled (the system is an ERP system), which they can "install" I.e. upload to a server which then the client will call via rest. We have this in place for the old jquery client, but we're now rewriting with angular. Not seeing how one can go about this in a secure way. 🤔
Hello, You need to use the HTTPClient module from Angular. I can make a video on that soon. What you need is to 1) Inject HTTPClient to the component constructor(private client: HttpClient) 2) Then call get, post, delete, or put For more in depth, you can use this documentation for now: angular.io/guide/http
@@Codeible Thanks, but that's not my main concern. I've been working with angular for many years so I have a good understanding about most of the framework. Definitely http client is used for getting the data/script from the server, my main concerns is security when it comes to loading in some external script in the application. I think I would want to provide users with an scripting api they can use, I.e predefined functions they can call from the script which I can have at least some control of. Oh well, a problem for another workday... 😊
Thank you for the quick tip. But If I declare the function inside the Constructor() the page crashes. After I left the constructor empty it worked. I don't know why. God bless
Thank you mate! worked here!!! I was strougling cause I've never worked with Angular before, I accepted a job that requires this framework and I didn't knew why my script wasn't working. Thank you so much!
Hello, bro! You best, you helped me solve a problem! You video helped me understand how to include my file.js when I go from one page to two, that works my file.js!
Thank you, bro!
The point is WE NEES TO RESTART TRH SERVER. I tried many, but didn't work any for me.. If the code is not working, please restart the server... Great Vdo😀🙌
Thanks it was really helpful
The declare function method doesn't seem to work in Angular 13. Do you happen to have a work-around for it? Thanks.
Hello I have a question, in timestamp 2:12 what if you have more than one local js file how are you going to include them or even the external js file that is not in your local project
i have a question if you can respond pls , does it work on angular 18 ?
this was helpful thanks
love you bro... helped a lot
Love you mannnnn,
If the external js file is a library what we should do?
Should only need to include the path to the folder.
Hello sir I did exactly as you did in the video. However, I can't access elements using document.querySelector or document.querySelectorAll. Only alert and console.log work but the JS file can't access the html elements inside my component. Please provide help
Hello, if your scripts uses the document object, you will need to do it in the component.
@@Codeible would you please tell me how?
@@seifmoustafa3005 Is it a local file?
@@Codeible yes
@@Codeible sorry I meant to say no
Hello sir, if i need to include my js file but only after 'ng serve' and not on reload page
Hello, what do you mean?
Let's say you have a deployed script you'd want to fetch and execute, e.g. a custom script for enhancing application functionality I.e. extensibility, how would you do that?
Do you mean calling a REST API?
@@louisyan135 Yeah, so in my use case, customers can create scripts themself to extend/customize the application, e.g disabling a form field they wish never to be enabled (the system is an ERP system), which they can "install" I.e. upload to a server which then the client will call via rest. We have this in place for the old jquery client, but we're now rewriting with angular. Not seeing how one can go about this in a secure way. 🤔
Hello,
You need to use the HTTPClient module from Angular.
I can make a video on that soon.
What you need is to
1) Inject HTTPClient to the component
constructor(private client: HttpClient)
2) Then call get, post, delete, or put
For more in depth, you can use this documentation for now:
angular.io/guide/http
@@Codeible Thanks, but that's not my main concern. I've been working with angular for many years so I have a good understanding about most of the framework. Definitely http client is used for getting the data/script from the server, my main concerns is security when it comes to loading in some external script in the application. I think I would want to provide users with an scripting api they can use, I.e predefined functions they can call from the script which I can have at least some control of. Oh well, a problem for another workday... 😊
Thanks bro
Thank you for the quick tip. But If I declare the function inside the Constructor() the page crashes. After I left the constructor empty it worked. I don't know why. God bless
Hello, what do you mean declare the function insided the constructor?
Do you mean declare var ...? You need to do that outside the component.
@@Codeible Ooooooh. my bad. I'm very noob at Angular. It's very confusing. Thank you for the help. Now it's working. God bless
how to run popup in file js when file js is not declare in file ts?
Is file.js a file you have?
thanks
thanks, it still confuse me why angular is like this, I just need to simply add a script to my file.
Not working in 2023
const amazingMan = 'Codeible';
console.log('thanks for this nice video ' + amazingMan)