Skip to content
Advertisement

Tag: angular

Angular: Type string is not assignable to type date

In Angular, I wrote a code as below. FYI, the type of created_date is Date. However, in here, I see the error as – type ‘string’ is not assignable to type ‘date’. If I amend new Date before the formatDate(…) then I see the unwanted result. How can I get the result with the format “yyyy-MM-dd hh:mm”? Answer formatDate return

Image didn’t appear in my angular project

I am learning angular by following steps in a book and there’s a task that demanded creating a product component like in Amazon.For each product, we have an image, the product name, the product release date, the rating component and the number of ratings it has. I followed all steps but the image didn’t appear in after compiling my code.Can

Angular Nested Child Routing

I am learning use of multiple router-outlet. While using navigateBy function of router, i am not able to view my child route and getting error. But if i access it via routerLink in html i get the desired output. So in below code, navigation to songs is working , but navigation to films is not. App Component html Bollywood Component

Change in one dropdown value is affecting other dropdowns

I have a add button which will keep on adding a div container which consists of two dropdowns. On selecting on dropdown we are setting other dropdown data. When I click on add div it will add a second div with both dropdowns. But, change in one dropdown is affecting other dropdown. app.component.ts app.component.html After adding div, each dropdown should

Identify origin of an observable event on subscription

I have a BehaviorSubject<Array<user>> (userListSub$) state that is updated from various places. For example, when I click Follow on a user when I click Unfollow on a user when I favorite a user The same state is being subscribed in different components. I would like a particular component to not react to an event emitted by the state (userListSub$) if

TypeScript 4.6.4 is indicating that this code is not valid

How do I resolve this Typescript issue? Message from Console Error: src/app/auth/authservice.ts:56:20 – error TS2345: Argument of type ‘string | null’ is not assignable to parameter of type ‘string’. Type ‘null’ is not assignable to type ‘string’. I added the // @ts-ignore but WebStorm is complaining that there is an error. Answer Let’s ignore the fact that JSON.parse()’s call signature

Advertisement