Creating a dynamic calendar application with Angular 2 using PrimeNG components

After diving into PrimeNG, I diligently followed the instructions on their documentation to get everything set up. However, my UI ended up looking quite odd, similar to the image below. Does anyone have any insight as to why this might be happening?

Here are some key pieces of code:

TS

import {CalendarModule} from 'primeng/primeng';

imports: [
BrowserModule,
FormsModule,
HttpModule,
routing,
CalendarModule],

HTML

<p-calendar [(ngModel)]="startDate" [showIcon]="true" name="startDate"></p-calendar> <span style="margin-left:35px"></span>

On another note, can anyone provide guidance on how to apply one of the themes showcased on the PrimeNG website? I tried locating the code for the free themes but was unsuccessful. Thank you in advance for your assistance.

Calendar UI reference:

https://i.sstatic.net/swjir.png

Answer №1

Take a look at the approved solution in this Stack Overflow thread. The PrimeNG team tends to use the most recent snapshot for their online documentation, so the official release may be slightly delayed.

JavaScript library requirements

They are currently updating the calendar component to make it entirely native. Starting from PrimeNG 1.0.0-beta.19, this should work smoothly. In the meantime, you will need to include several dependencies:

<!-- Datetimepicker, Slider, Schedule -->
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-ui-timepicker-addon/1.6.1/jquery-ui-timepicker-addon.min.js"></script>

or:

<script src="node_modules/primeui/primeui-ng-all.min.js"></script>

CSS requirements

Don't forget to set up all the necessary CSS dependencies correctly. The relevant page of the PrimeNG documentation lists the following files to be added:

<link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/themes/omega/theme.css" />
<link rel="stylesheet" type="text/css" href="/node_modules/primeng/resources/primeng.min.css" />
<link rel="stylesheet" type="text/css" href="YOUR_PATH/font-awesome.min.css" />

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Mat-button click event is unresponsive when Mousemove is triggered on a smartphone using material.angular

I have encountered an issue with Angular Material. Everything works smoothly on a desktop browser, but when using a smartphone or developer tools in Chrome, I noticed that the (click) event of a button does not fire if you move the cursor even by just one ...

"In Nextjs, it is not possible to utilize the alert function or assign variables directly to the window object

Are you attempting to quickly sanity test your application using the window object's alert function, only to encounter errors like "Error: alert is not defined"? import Image from "next/image"; alert('bruh'); export default function Home() ...

The functionality of ngModel seems to be malfunctioning when used within select options that are generated inside

I'm currently working on dynamically adding options to an HTML select element within a for loop. I am using [(ngModel)] to get the selected option, but initially no option is pre-selected. Here's a snippet of the code: <table align="center"& ...

What could be causing the HTTP response Array length in Angular to be undefined?

Currently, I am facing an issue while retrieving lobby data from a Spring Boot API to display it in my Angular frontend. After fetching the data and mapping it into an object array, I encountered a problem where the length of the array turned out to be und ...

What is the equivalent of Buffer.from(<string>, 'hex') in Python?

I am currently facing the challenge of translating a Typescript library into Python. The specific library I am working with is bs58 in Typescript and its counterpart base58 in Python. My issue arises when attempting to replicate the following code: const ...

Here is a way to trigger a function when a select option is changed, passing the selected option as a parameter to the function

Is there a way to call a function with specific parameters when the value of a select element changes in Angular? <div class="col-sm-6 col-md-4"> <label class="mobileNumberLabel " for="mobilrNumber">Select Service</label> <div cla ...

Incorporating a component specified in a .jsx file into a TypeScript file

We recently acquired a react theme for our web application, but ran into issues transpiling the components. After resolving that problem, we are now facing type-related challenges. It seems that TypeScript is struggling because the props do not have a def ...

Best Practices for Integrating Angular with Your Custom JavaScript Library

Imagine needing to create a TypeScript function that can be utilized across various components, services, or modules. For example, let's say you want an alert wrapper like this: my_alert(msg); // function my_alert(msg) { alert(msg); } You might hav ...

Activate OnChanges by modifying a property within the object that is bound to the data

Is there a way to make ngOnChanges() fire when a property of a data-bound object changes without needing to assign a new object to the property? // Inside the component @Input() myObj: ObjType; // Component code... The above scenario does not trigger the ...

Implementing a strategy for managing multiple subdomains and angular applications in conjunction with nodejs

My goal is to implement a system with multiple dynamic subdomains for account holders, as well as an api subdomain. Here's what I envision: https://example.com --> Angular 4 public landing page app https://api.example.com --> NodeJS api https:/ ...

Capturing full-page screenshots with Protractor in Angular 8

Currently, I am facing an issue while trying to capture a screenshot of an Angular page using protractor and mocha. Our team has integrated protractor-screenshot-utils as a dependency and added the necessary code in the conf.js file to modify the browser.t ...

Utilize Angular HttpClient to send a new Array created from fresh FormData to the server

I have an Array of Objects that contains files (images) with unique fields. When submitting, a new Array of Objects is sent to the server using Angular HttpClient. // Original Array of Objects let originalArray = [ { "name": & ...

Unit tests in Jasmine disable dispatchers when NGXS store.reset is invoked

I am facing a challenge with an unusual behavior during the unit testing of my NGXS store using Jasmine. Specifically, I am encountering issues when trying to test the DeleteAlerts action : @Action(DeleteAlerts) deleteAlerts(ctx: StateContext<Alert ...

Angular Material: Enable Window Dragging Across Multiple Monitors

Exploring the usage of Angular Material Dialog or any other Popup Window Component. The functionality is mostly working as expected, with the exception of the last point. a) The original screen should not have a grey overlay, b) Users should be able to i ...

Crafting a recursive Typescript Immutable.js Record through typing

I am currently working on representing a tree-like data structure using immutable js and typescript. At the moment, I am utilizing regular vanilla js objects to depict the nodes within the tree. Below is the type signature. type NodeType = { value: str ...

Error: The AppModule encountered a NullInjectorError with resolve in a R3InjectorError

I encountered a strange error in my Angular project that seems to be related to the App Module. The error message does not provide a specific location in the code where it occurred. The exact error is as follows: ERROR Error: Uncaught (in promise): NullInj ...

Challenge Encountered with Create-React-App TypeScript Template: Generating JS Files Instead of TSX Files

Encountering a problem setting up a new React application with TypeScript using the Create-React-App template. Followed the guidelines on the official documentation (https://create-react-app.dev/docs/adding-typescript/) and ran the command below: npx creat ...

What is the process for validating multiple check boxes using the reactive forms module?

I thought this would be a simple task, but I'm having trouble figuring it out. There are three checkboxes and I need to ensure that the user selects only one. The validator should check if any of the other two checkboxes have been selected and preven ...

The field 'XXX' is not a valid property on the type 'CombinedVueInstance<Vue, {}, {}, {}, Readonly<Record<never, any>>>'

When creating a Vue component with TypeScript, I encountered an error message in the data() and methods() sections: Property 'xxx' does not exist on type 'CombinedVueInstance<Vue, {}, {}, {}, Readonly<Record<never, any>>>& ...

What strategy should be employed for creating a database abstraction layer in Angular?

When it comes to Angular, what is the optimal method for implementing a database abstraction layer that functions similarly to a Content Provider in Android? ...