Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get styling applied to calendar #71

Closed
gh0st opened this issue Oct 13, 2016 · 13 comments
Closed

Can't get styling applied to calendar #71

gh0st opened this issue Oct 13, 2016 · 13 comments

Comments

@gh0st
Copy link

gh0st commented Oct 13, 2016

This is the closest I can get to applying styling following code in the demo.
screen shot 2016-10-12 at 19 23 09

The only error I'm getting in my browser is

[Error] TypeError: undefined is not an object (evaluating 'window.FontAwesomeCdnConfig.asyncLoading')
    runTask (main.bundle.js:79243)
    invoke (main.bundle.js:79407)

I do not have an entry.ts but I'm using a main.ts inside my src folder. It's contents are

import 'bootstrap/dist/css/bootstrap.css';
import 'font-awesome/css/font-awesome.css';
import 'angular2-calendar/dist/css/angular2-calendar.css';
import 'intl';
import 'intl/locale-data/jsonp/en';
import 'core-js';
import 'zone.js/dist/zone';
import './polyfills.ts';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { environment } from './environments/environment';
import { AppModule } from './app/';

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule);
@mattlewis92
Copy link
Owner

I can't see anything that'd obviously wrong there, I suspect it's probably an issue with your build tool. What are you using? e.g. webpack, system.js etc?

@gh0st
Copy link
Author

gh0st commented Oct 13, 2016

@mattlewis92 I'm using angular-cli which uses webpack as my build tool.

@mattlewis92
Copy link
Owner

That'd odd, it should just work with the CLI. There's definitely some other config interfering with your app though as from the screenshot you can see the optional bootstrap theme is also being included and it's not referenced in the code snippet you included.

@mattlewis92
Copy link
Owner

Ah, this is a CLI issue actually, they don't support including stylesheets in typescript config as it's non standard: angular/angular-cli#1459

I think you need to include the stylesheet somewhere in your cli config, there was a PR referenced at the end of that issue that shows how to do it.

@kodiraj
Copy link

kodiraj commented Oct 19, 2016

i am also facing the same issue.i am not getting any error
screen shot 2016-10-19 at 12 12 24 pm

@mattlewis92
Copy link
Owner

@kodiraj you're not including the stylesheets into your app. You need this somewhere:

import 'angular2-calendar/dist/css/angular2-calendar.css';

@JohnnyMatteus
Copy link

Just include it in angular.json and refresh the application. Because the CLI does not recognize the @import by the browser, it even loads, but the settings does not apply. I am using CLI version 6.0.x

@JohnnyMatteus
Copy link

@kodiraj você não está incluindo as folhas de estilo em seu aplicativo. Você precisa disso em algum lugar:

import 'angular2-calendar/dist/css/angular2-calendar.css';

I made this configuration in angular.json and it worked

@moytho
Copy link

moytho commented Dec 18, 2019

Same thing here. Just added this css file into my angular.json styles section
"styles": [ "styles/index.scss", "./node_modules/angular-calendar/css/angular-calendar.css" ],

@Manoj-Khadka
Copy link

include the CSS file in the global (not component scoped) styles of your app:

/* angular-cli file: src/styles.css */
@import "../node_modules/angular-calendar/css/angular-calendar.css";

@Shabaltasov
Copy link

Shabaltasov commented Sep 18, 2023

include the CSS file in the global (not component scoped) styles of your app:

/* angular-cli file: src/styles.css */ @import "../node_modules/angular-calendar/css/angular-calendar.css";

Hi, I have error :
Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
HookWebpackError: Module build failed (from ./node_modules/css-loader/dist/cjs.js):
Error: Package path ./css/angular-calendar.css is not exported from package ...\node_modules\angular-calendar (see exports field in ...\node_modules\angular-calendar\package.json)

I include the CSS file in the global styles of my app:
@import "../node_modules/angular-calendar/css/angular-calendar.css";

In angular.json I alreadyhave this style
"styles": [
"node_modules/angular-calendar/css/angular-calendar.css",
"projects/business-slick-estimates/src/styles.scss"
],
angular/cli: "^15.2.7"

PLease, tell me how to fix it.

@Shabaltasov
Copy link

Shabaltasov commented Sep 18, 2023

include the CSS file in the global (not component scoped) styles of your app:
/* angular-cli file: src/styles.css */ @import "../node_modules/angular-calendar/css/angular-calendar.css";

Hi, I have error : Error: Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js): HookWebpackError: Module build failed (from ./node_modules/css-loader/dist/cjs.js): Error: Package path ./css/angular-calendar.css is not exported from package ...\node_modules\angular-calendar (see exports field in ...\node_modules\angular-calendar\package.json)

I include the CSS file in the global styles of my app: @import "../node_modules/angular-calendar/css/angular-calendar.css";

In angular.json I alreadyhave this style "styles": [ "node_modules/angular-calendar/css/angular-calendar.css", "projects/business-slick-estimates/src/styles.scss" ], angular/cli: "^15.2.7"

PLease, tell me how to fix it.


I got away from the problem of connecting styles and added a line
link href="https://unpkg.com/angular-calendar@0.20.0/dist/css/angular-calendar.css" rel="stylesheet"
in my component template
I’m not sure about the optimality and correctness of this solution, so I’ll wait for your answers and comments, thx

@Shabaltasov
Copy link

Shabaltasov commented Aug 5, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants