Troubleshoot: Angular 2 Carousel not Showing up on Page

Having trouble understanding why my carousel component is present but none of the CSS or images are showing up.

This is my app.component.ts file:

import { Component } from '@angular/core';

// Import our Carousel Component
import {CSSCarouselComponent} from './carousel.component';

@Component({
  selector: 'my-app',
  directives: [CSSCarouselComponent],
  templateUrl: 'app/app.component.html'
  // Declare the use of css-carousel tag in this component
})
export class AppComponent { }

Next, let's look at carousel.component.ts:

// Import Component from angular core package
import {Component} from  '@angular/core';

// Import Image interface
import {Image} from './image.interface';

// Component Decorator
@Component({
  selector: 'css-carousel',
  template:`
  <div class="cover">
    <div class="carousel">
      <ul class="slides">
        <li *ngFor="let image of images">
          <h2>{{image.title}}</h2>
          <img src="{{image.url}}" alt="">
        </li>
      </ul>
    </div>
  </div>
  `,
  styles: [`
.carousel{
    overflow:hidden;
...
...
}
@keyframes carousel{
    0%, 23% {margin-left:0}
...
...
}

// Images array implementing Image interface
var IMAGES: Image[] = [
  { "title": "Cod en Papillote ", "url": "images/cod.jpg" },
...
...
];

Now, let's take a look at the Image Class used to declare an image:

export interface Image {
  title: string;
  url: string;
}

This is my app.component.html file (where the carousel should be displayed):

<!-- Navbar Info -->
<nav class="navbar navbar-fixed-top">
...
...
</ul>
</div>
</nav>
<body>
  <css-carousel></css-carousel>
</body>

All other files are set up as per the default Angular 2 quickstart setup. While I was able to run the carousel as a standalone component, I'm facing difficulties integrating it with the navigation bar.

Answer №1

Resolved: Upon inspection of the CSS, it was discovered that the carousel's width was inadequate for proper display within the wrapper class.

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

Challenges regarding the CSS styling of the ui bootstrap modal and its compatibility with

Currently, I am in the process of developing a webpage utilizing angularjs and ui bootstrap to generate modals. However, as I attempt to print just the modal using javascript, I have encountered an issue with my CSS. It seems that due to potential formatti ...

Using JQuery to load a page into a div with custom styles

I need to implement the use of .load in order to load an external page into a div on the current user's page. Does .load also apply the styles from the current stylesheet defined in that page after loading the content? If not, what alternatives should ...

What is the best way to display a loading state while waiting for all Firebase data requests to be fully processed?

Hey there! I'm looking for some advice on how to display a loading indicator like this: https://i.sstatic.net/7luvR.gif while waiting for my Firebase data to load completely. I attempted to use <div *ngIf="!listOfFoodObject"> <img [src ...

How can I animate scrolling up or down using jQuery and CSS?

I have a a element that triggers an action when clicked: <a href="#" class="hel" onclick="YPCP1_();">Scroll down</a> Also, function YPCP_(){ var scroll = $(window).scrollTop(); window.scrollTo(0, 600); } The function successfully sc ...

Encountering an undefined value despite having declared the variable in TypeScript

In my Angular application, I am encountering an issue while trying to add values to an array within a block of code. Even though I have defined the variable 'contactWithInitials', I keep receiving an error message stating 'Cannot read prope ...

Trigger and maintain click action in Javascript

I am currently in the planning stages of a project, and I'm facing an issue with a click and hold event. My goal is to have a div that allows me to click through it (meaning I can still interact with elements underneath), while having an opacity of ar ...

Modification of a CSS element

The CSS I am working with looks like this: .cls .imageX { float:left; } .cls .imageY { float:right; } It is currently being used on a page in this way: <div class="cls"> <a href="" class="imageX"><img src="left.png"/></a> &l ...

What is the reason for Jquery targeting every single div element that has the class rule-name assigned to it?

I am new to JQuery and I'm taking it slow. In my Tampermonkey script, I have included the following line of code and executed it on the desired page. $('<span id="matrixVarTableInit">Default Rule Tests</span>').insertAfter( "div ...

Conditionally displaying a select element using Ng-if

Is there a way to display content based on the user's selection in an HTML form? Here is how I attempted to do it: <select class="form-control" id="Intervencion" > <option selected disabled></option> <option (click)="show ...

jQuery Update for Header/Footer Navigation

I have implemented header and footer navigation with different states using jQuery. However, I am encountering an issue when trying to update the header nav upon clicking on the footer nav items. Specifically, I want the header nav to reflect the same sele ...

The custom width is not being applied to the Bootstrap column

I'm working on a Web Design project using Bootstrap. Here is a snippet of my HTML code: <div class="col utility_col"> <div class="row"> <div class="col vote_col">Vote</div> <div class="col sign_col"> < ...

Tips for filling the offset space with a column

Having a bit of trouble phrasing my question, but here's the issue I'm facing: Currently, I need to develop two different views, the first being the mobile view However, I'm experiencing some difficulties with the second view, which can be ...

Injecting Window into Angular 2.1.0: A Step-by-Step Guide

Previously, in the earlier RC versions of Angular 2, I was able to easily inject the window object by including {provide: Window, useValue: window} In the providers array. However, after updating to the latest stable release of Angular 2 (2.1.0), this no ...

What is the best method for adding or removing items using ID instead of classes?

Is there a way to change the highlight class to an id, so that clicking outside the products will not trigger the highlight effect? I have added the window.onload section with my desired changes, but I am unsure how to switch the class highlight to an id. ...

What is the best way to adjust text across several lines to perfectly fit within a div's width?

http://codepen.io/anon/pen/oXGMQZ Is there a way to automatically adjust the font size of each span within a parent div so that it fills the width of the parent div? <div class="box"> <span class="fit">what</span> <span class="fi ...

Using the CSS background position of 50% 50% is not effective

Is it possible to create a background in CSS for an element with unknown width and height that starts at the center and repeats? This is what I would like to achieve: This is the code I have written: body { background: url('http://www.lighthouse ...

To display a specific router link and its child routes, make use of the *ngIf directive

Issue: How can we display [content] in all child routes of a parent route such as <div *ngIf="router.url === '/parent/child'">[content]</div>, ensuring that content is shown in ./parent/child1, ./parent/child2, and so on? P ...

Angular 2 app creation is stuck in the process

Encountering an issue while trying to create a new App using the following command: ng new [MY_PROJECTNAME] --prefix [MY_Prefix] Steps taken before encountering the issue: Installed npm -g install angular-cli Installed npm -g install typings -> wh ...

Creative Vue.js and Tailwind CSS card layout featuring an image extending beyond the boundaries of the card

I'm attempting to design a card where an image pops out of the card. I've tried using z-index, but it doesn't seem to be working as expected. Here is the code I have: <div class="flex flex-col"> <div class=&quo ...

CSS: Flexible Sidebar - Dynamic Content

Can someone provide clarification on this visual illustration? To sum it up, I am looking to create a sidebar div that adjusts its width based on the content within, alongside a mainContent section that fills the remaining window width. ...