[Solved] Angular 2 onclick add new item in array

[ad_1] You have a few problems… You have this interface: interface Joke{ id: number; value: string; } what you are receiving is much more properties, so you’d need to pick the properties you want: getRandomJokes(){ return this.http.get(‘https://api.chucknorris.io/jokes/random’) .map(res => res.json()); // pick the properties you want/need .map(joke => <Joke>{id: joke.id, value: joke.value}) } Then you … Read more

[Solved] How to perform complex join on three tables [closed]

[ad_1] This should do it. If CategoryNAME coming back as null, then you’re doing a LEFT OUTER join and have referential integrity issues. CREATE PROCEDURE usp_OrderDetails_SelectByOrderId @OrderID INT AS BEGIN SELECT P.ProductId, OD.Qty, P.Price, C.NAME AS CategoryNAME FROM tblProducts P INNER JOIN tblCategories C ON P.CategoryId = C.CategoryId INNER JOIN tblOrderDetails OD ON P.ProductId = … Read more

[Solved] How to square integers inside an array?

[ad_1] Just map over the array and do Math.pow(int,power) but multiplication is faster so do value * value in the .map function const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34, -2]; // your array const squares = realNumberArray.filter(x => x > 0 && Number.isInteger(x)); // your filter function const squared = squares.map(val => … Read more

[Solved] How create dynamic list with class in C++ [closed]

[ad_1] you are recreating the arr 11 time in your loop i think you meant to do this : //the error is generated because you are trying to access an element out of bounds because your declaration is wrong std::vector<MyClass> arr; for(unsigned long long i = 0 ; i<=10;i++){ arr.emplace_back( 10,20+i); std::cout << arr[i].ggg; } … Read more

[Solved] How can I console.log the second li element using javascript onclick

[ad_1] Just use the querySelectorAll() method instead and target the second li element like this: document.querySelectorAll(“#list li”)[1].onclick = () => { console.log(“Biker Jacket”); }; <h3>Shirts</h3> <ul id=’list’> <li>Biker Jacket</li> <li>Mens Shirt</li> </ul> 1 [ad_2] solved How can I console.log the second li element using javascript onclick