Angular πŸ‡ΊπŸ‡¦ - practical notes
1.63K subscribers
1.6K photos
1 file
532 links
Angular - practical notes

This group is for posting practical notes for Angular developers. Mostly all posts are for quick implementation https://t.me/angular_practical_notes (Commenting on posts only in ENG and UA langs here). Welcome!
Download Telegram
⚠️ Signals in Angular (new approach of reactivity)

#angular #signals

🚩 > Angular 16

βœ… Link: https://medium.com/@simon.sharp_25406/signals-in-angular-3dc2c97ce5a6
js.reduce(): Deserialize query string

#js #reduce

βœ… Example:
function ParseQueryString(queryString) {
return queryString
.replace(/(^\?)|(&$)/g, "")
.split("&")
.reduce((t, v) => {
const [key, val] = v.split("=");
t[key] = decodeURIComponent(val);
return t;
}, {});
}

const urlExample = "?name=Bytefer&email=bytefer%40gmail.com";
const queryParam = ParseQueryString(urlExample);
// queryParam: { name: 'Bytefer', email: 'bytefer@gmail.com' }
❀2
js.reduce(): Split array into chunks

#js #reduce

βœ… Example:

function Chunk(array, size) {
return array.reduce((acc, _, index) => {
if (index % size === 0) acc.push(array.slice(index, index + size));
return acc;
}, []);
}

const numbers = [1, 2, 3, 4, 5, 6, 7];
const arr3 = Chunk(numbers, 2);
// Output: arr3: [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ], [ 7 ] ]