angular create library
ng generate library my-lib ng build my-lib
Here is what the above code is Doing:
1. Create a new Angular workspace called my-workspace.
2. Create a new library called my-lib inside the workspace.
3. Build the library.
ng generate library my-lib ng build my-lib
Here is what the above code is Doing:
1. Create a new Angular workspace called my-workspace.
2. Create a new library called my-lib inside the workspace.
3. Build the library.
module.exports = { async rewrites() { return [ { source: ‘/about’, // this will the new route destination: ‘/’, // this is the old route }, ] }, } Here is what the above code is Doing: 1. We’re exporting a function called rewrites. 2. We’re returning an array of objects. 3. Each object has…
//Instant scroll to top of page window.scrollTo(0, 0); Here is what the above code is Doing: 1. We’re creating a function called “scrollToTop” 2. We’re adding an event listener to the window object that listens for the “scroll” event 3. We’re adding an if statement that checks if the scroll position is greater than 100px…
var transporter = nodemailer.createTransport(‘smtps://user%40gmail.com:pass@smtp.gmail.com’); // create template based sender function var sendPwdReminder = transporter.templateSender({ subject: ‘Password reminder for {{username}}!’, text: ‘Hello, {{username}}, Your password is: {{ password }}’, html: ‘Hello, {{username}}, Your password is:\n{{ password }}’ }, { from: ‘sender@example.com’, }); // use template based sender to send a message sendPwdReminder({ to: ‘receiver@example.com’ }, {…
“maingame”: { “day1”: { “text1”: “Tag 1”, “text2”: “Heute startet unsere Rundreise \” Example text\”. Jeden Tag wird ein neues Reiseziel angesteuert bis wir. ” } } // (just one backslash (\) in front of quotes). Here is what the above code is Doing: 1. We’re creating a JSON object called “maingame”. 2. Inside “maingame”,…
var someEventHander=function(){ console.log(“do something”); } var handlerCopy=someEventHandler.bind(var1,var2) //add listener document.getElementById(“someid”).addEventListener(‘click’,handlerCopy,true); //remove listener document.getElementById(“someid”).removeEventListener(‘click’,handlerCopy,true); Here is what the above code is Doing: 1. The first line creates a function that will be called when the event is triggered. 2. The second line creates a copy of the function, but with the context of the first argument…
import {Router} from ‘@angular/router’; constructor(private router: Router) {} navigateToLogin() { this.router.navigateByUrl(‘/login’); } Here is what the above code is Doing: 1. We are importing the Router service from the @angular/router package. 2. We are injecting the Router service into the constructor of the component. 3. We are calling the navigateByUrl() method of the Router service…