Giter VIP home page Giter VIP logo

ngx-scrollreveal's Introduction

ngx-scrollreveal - Angular directives for ScrollReveal JS

npm version Build Status Coverage Status devDependency Status Greenkeeper Badge

ScrollReveal is a JavaScript library for easily animating elements as they enter/leave the viewport.

Demo

View all the directives in action at https://tinesoft.github.io/ngx-scrollreveal

Dependencies

  • Angular (requires Angular 6+, v2.2.0 is the latest version for Angular < 6 )
  • ScrollReveal (requires ScrollReveal 4 or higher, tested with 4.0.2)

Installation

Install above dependencies via npm. In particular for ScrollReveal JS, run:

npm install --save scrollreveal

Angular-CLI

Note: If you are using angular-cli to build your app, make sure that scrollreveal is properly listed as a global library, by editing your angular.json as such:

      "scripts": [
        "../node_modules/scrollreveal/dist/scrollreveal.js"
      ],
SystemJS

Note:If you are using SystemJS, you should adjust your configuration to point to the UMD bundle. In your systemjs config file, map needs to tell the System loader where to look for ngx-scrollreveal:

map: {
  'ngx-scrollreveal': 'node_modules/ngx-scrollreveal/bundles/ngx-scrollreveal.min.js',
}

In your systemjs config file, meta needs to tell the System loader how to load scrollreveal:

    meta: {
    './node_modules/scrollreveal/dist/scrollreveal.min.js': {
            format: 'amd'
        }
    }

In your index.html file, add script tag to load scrollreveal globally:

    <!-- 1. Configure SystemJS -->
    <script src="system.config.js"></script>
    <!-- 2. Add scrollreveal dependency-->
    <script src="node_modules/scrollreveal/dist/scrollreveal.min.js"></script>

Now install ngx-scrollreveal via:

npm install --save ngx-scrollreveal

Once installed you need to import the main module:

import {NgsRevealModule} from 'ngx-scrollreveal';
import {NgsRevealModule} from 'ngx-scrollreveal';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgsRevealModule],  
  bootstrap: [AppComponent]
})
export class AppModule {
}

Usage

The library is composed of two main directives: ngsReveal and ngsRevealSet.

ngsReveal Directive


Use this directive to reveal/hide a single DOM element upon scroll.

Basic Usage
    <div class="item" ngsReveal>..</div>
With Custom Options

You can also pass in a custom configuration object to the directive.

    <div class="item" [ngsReveal]="{ reset: true}" >..</div>

This will override the default configuration used when revealing this particular element. When no configuration is passed in, the directive uses the default configuration defined at component or at application level.

Configuration options are the same as ScrollReveal JS configuration object.

ngsRevealSet Directive


Use this directive to reveal/hide a set of DOM elements upon scroll.

[ngsSelector] attribute is required, and defines which child items must be revealed/hidden on scroll.

Note: The value is a list of CSS selectors (comma-separated).

Basic Usage

    <div class="itemset" ngsRevealSet [ngsSelector]="'.item'">
        <div class="item item1">Item 1</div>
        <div class="item item2">Item 2</div>
        <div class="item item3">Item 3</div>
        <div class="item item4">Item 4</div>
        <div class="item5">Item 5 (will not be animated)</div>
    </div>

With Custom Options

    <div class="itemset" [ngsRevealSet]="{ reset:true}" [ngsSelector]="'.item'">
        <div class="item item1">Item 1</div>
        <div class="item item2">Item 2</div>
        <div class="item item3">Item 3</div>
        <div class="item item4">Item 4</div>
        <div class="item5">Item 5 (will not be animated)</div>
    </div>

Configuration options are the same as ScrollReveal JS configuration object.

Sequentially animated items

Child items inside the parent set can be sequentially animated, by adding the [ngsRevealInterval] attribute.

Note: The interval is the time until the next element in the sequence begins its reveal, which is separate from the time until the element’s animation completes. In this example, the sequence interval is 50 milliseconds.

    <div class="itemset" [ngsRevealSet]="{ reset:true}" [ngsInterval]="50" [ngsSelector]="'.item'">
        <div class="item item1">Item 1</div>
        <div class="item item2">Item 2</div>
        <div class="item item3">Item 3</div>
        <div class="item item4">Item 4</div>
        <div class="item5">Item 5 (will not be animated)</div>
    </div>

Global Configuration


You can inject the config service, typically in your root component, and customize the values of its properties in order to provide default values for all the ng-reveal directives used in the application.

import {Component} from '@angular/core';
import {NgsRevealConfig} from 'ngx-scrollreveal';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss'],
  providers: [NgsRevealConfig] // add NgsRevealConfig to the component providers
})
export class AppComponent {
  constructor(config: NgsRevealConfig) {
    // customize default values of ngx-scrollreveal directives used by this component tree
    config.duration = 5000;
    config.easing = 'cubic-bezier(0.645, 0.045, 0.355, 1)';

    //other options here
  }
}

Subscribing to ScrollReveal events


You can now subscribe to some events triggered by ScrollReveal before/after an element is revealed/reset.

import { Component, OnInit, OnDestroy } from '@angular/core';
import { NgsRevealService } from 'ngx-scrollreveal';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit, OnDestroy{
  constructor(private revealService: NgsRevealService) {
  }
  
  ngOnInit() {
    // subscribe to ScrollReveal observables to react to main events
    this.beforeRevealSubscription = this.revealService.beforeReveal$.subscribe(
      (el: HTMLElement) => {
        console.log(`beforeReveal of '<${el.nodeName}>.${el.className}'`);
      });

    this.afterRevealSubscription = this.revealService.afterReveal$.subscribe(
      (el: HTMLElement) => {
        console.log(`afterReveal of '<${el.nodeName}>.${el.className}'`);
    });

    this.beforeResetSubscription = this.revealService.beforeReset$.subscribe(
      (el: HTMLElement) => {
        console.log(`beforeReset of '<${el.nodeName}>.${el.className}'`);
    });

    this.afterResetSubscription = this.revealService.afterReset$.subscribe(
      (el: HTMLElement) => {
        console.log(`afterReset of '<${el.nodeName}>.${el.className}'`);
    });
  }

  ngOnDestroy() {
    // unsubscribe to ScrollReveal observables to prevent memory leaks
    this.beforeRevealSubscription.unsubscribe();
    this.afterRevealSubscription.unsubscribe();
    this.beforeResetSubscription.unsubscribe();
    this.afterResetSubscription.unsubscribe();
  }
}

Credits

ngx-scrollreveal is built upon ScrollReveal JS by Julian Lloyd. Thanks to him for the great work!

ngx-scrollreveal's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ngx-scrollreveal's Issues

Error in jest test

When i run test with Jest i get this error.

import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
.....
import { NgsRevealModule } from 'ngx-scrollreveal';

describe('AppComponent', () => {
  beforeEach(async(() => {

    TestBed.configureTestingModule({
      imports: [
        RouterTestingModule,
       ....
        NgsRevealModule

      ],

      declarations: [
        AppComponent,
        ...
        ...

      ]
    }).compileComponents();
  }));

  it('should create the app', () => {
    const fixture = TestBed.createComponent(AppComponent); => ReferenceError: ScrollReveal is not defined Jest
    const app = fixture.componentInstance;
    expect(app).toBeTruthy();
  });

is there a way to fix it?
Thanks

Update for Angular 4

Could you please upgrade package.json to also accept Angular 4.x?
Maybe something similar to

"peerDependencies": {
   "@angular/common": "^2.3.1 || >=4.0.0",
   "@angular/compiler": "^2.3.1 || >=4.0.0",
   "@angular/core": "^2.3.1 || >=4.0.0",
 },

how can you show them when they are on a scroll position

Hi,

I want to show slide 2,3,4 when i scroll to them. Now they are animated all at once.
What do i need to change to have this behavior?

html:

<div class="itemset about" [ngsRevealSet]="{reset: true, container: '.itemset'}" [ngsSelector]="'.item'">
  <div class="slide item one"> Block One </div>
  <div class="slide item two"> Block Two </div>
  <div class="slide item three"> Block Three </div>
  <div class="slide item four"> Block Four </div>
</div>

css:

.slide {
  position: relative;
  height:400px;
}

Kind regards,

Allaerd

ngsReveal shows only the viewport "items"

Hello!
The issue is that only the "items" which are in the viewport on load are shown, the others are hidden even on scroll.

If the viewport is big enough by default to contain two divs, the divs are shown onload, if the viewport is smaller and can place only one div, this div is shown only, no other divs appear on scroll.

OS: ElCapitan 10.11.3
Browser: Chrome 53.0.2785.143 (64-bit)
scrollreveal: ^3.3.2
ng2-scrollreveal: ^1.0.0

Both the Chrome console and Terminal show no errors, warnings, etc.

My code for scroll reveal section:

`

   <div class="itemset about" ngsRevealSet [ngsSelector]="'.item'">

   <div class="item one"> Block One </div>

  <div class="item two"> Block Two </div>

   <div class="item three"> Block Three </div>

   <div class="item four"> Block Four </div>

    </div>

`

My CSS for that section:
`
/About/
.about {
overflow: auto;
height: 100%;
width: 100%;
font-size: 2rem;
margin-top: 70px;
text-align: center;
}

.item {
height: 400px;
}

.one {
background: red;
}

.two {
background: yellow;
}

.three {
background: grey;
}

.four {
background: cyan;
}
`

I also inspected the hidden blocks in the Chrome console, and they have

opacity:0; visibility:visible;

and animation is at the starting point (when I manually change the visibility property, the divs shown as they are stuck in the very beginning of animation).

I also use Bootstrap grid (only!), but as I can see there are no intersected styles. So, everything should work correctly, but it doesn't.

Can't bind to 'ngsReveal' since it isn't a known property of 'div' and nothing works

OS and Version?

Versions

Angular CLI: 12.0.4
Node: 14.15.4
Package Manager: npm 6.14.10
OS: win32 x64

Angular: 12.0.5
... animations, cdk, common, compiler, compiler-cli, core, forms        
... material, platform-browser, platform-browser-dynamic, router        

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.4
@angular-devkit/build-angular   12.0.4
@angular-devkit/core            12.0.4
@angular-devkit/schematics      12.0.4
@angular/cli                    12.0.4
@angular/flex-layout            12.0.0-beta.34
@schematics/angular             12.0.4
rxjs                            6.6.7
typescript                      4.2.4

Angular.json

        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/carminer",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "inlineStyleLanguage": "scss",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.scss",
              "node_modules/fontisto/css/fontisto/fontisto.min.css",
              "node_modules/scrollreveal/dist/scrollreveal.js",
            ],
            "scripts": []
          },

Repro steps

npm i --save-dev scrollreveal
npm i --save ngx-scrollreveal
npm install --save-dev @types/scrollreveal

//Angular Json
"node_modules/scrollreveal/dist/scrollreveal.js"

The log given by the failure

Implementation

  • app.module.ts
//SomeCode
import { HomeModule } from './components/home/home.module';
import { NgsRevealModule } from 'ngx-scrollreveal';

@NgModule({
  declarations: [
    AppComponent,
    //somecode
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    SharedModule,
    HomeModule,
    NgsRevealModule,
]
)}
  • Home.module.ts
@NgModule({
  declarations: [
    BannerComponent,
    HomeComponent,
//somecode
  ],
)}
  • Banner.component.html
 <div ngsReveal [ngsReveal]="{ reset: true}" class="banner-container__background">
    <div class="banner-container__wave">
<div  ngsReveal class="banner-container">
  <div ngsReveal  class="banner-container__content">
    <h1 ngsReveal class="banner-content__title">¡Descúbre en segundos el <span>
        valor real</span> de tu vehículo!</h1>
    <h2 ngsReveal class="banner-content__description">Encuentra el valor real del
      vehiculo de tus sueños</h2>
    <div ngsReveal class="banner-container__option">
      <a ngsReveal class="banner-container__option--button">Empezar</a>
      <a ngsReveal class="banner-container__option--button">Contactar</a>
    </div>
  </div>
</div>
</div>
</div>

Desired functionality

I have hours trying to implement this, reinstall, go back and do the steps over and over again, not even the ngsReveal works, all directives fail.

It still finds the libraries installed, that's good. The only problem is that no directive is recognized

I made this template in JavaScript, I want to do the same in Angular:
https://pedromaironi.github.io/homepage-uiux/

Cannot use with ngFor and custom directive

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

macOS 10.14.2

Versions

Angular CLI: 7.1.2
Node: 10.0.0
OS: darwin x64
Angular: 7.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.11.2
@angular-devkit/build-angular     0.11.2
@angular-devkit/build-optimizer   0.11.2
@angular-devkit/build-webpack     0.11.2
@angular-devkit/core              7.1.2
@angular-devkit/schematics        7.1.2
@ngtools/webpack                  7.1.2
@schematics/angular               7.1.2
@schematics/update                0.11.2
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.23.1

Repro steps

    <div class="itemset" ngsRevealSet [ngsSelector]="'.item'">
            <div *ngFor="let x of [1,2,3]">
                   <my-custom-component class="item"></my-custom-component>
             </div>
    </div>

it also doesn't work with just an *ngFor:

<div
  class="itemset"
  ngsRevealSet
  [ngsSelector]="'.item'"
  *ngFor="let x of [1, 2, 3]"
>
  <div>{{ x }}</div>
</div>

or the same but with a nested div:

<div class="itemset" ngsRevealSet [ngsSelector]="'.item'">
  <div *ngFor="let x of [1, 2, 3]">
    <div>{{ x }}</div>
  </div>
</div>

the example does work, so i know the lib is configured correctly:

    <div class="itemset" ngsRevealSet [ngsSelector]="'.item'">
        <div class="item item1">Item 1</div>
        <div class="item item2">Item 2</div>
        <div class="item item3">Item 3</div>
        <div class="item item4">Item 4</div>
        <div class="item5">Item 5 (will not be animated)</div>
    </div>

Desired functionality

<my-custom-component class="item"></my-custom-component> should animate in.

Problem with Angular Universal (Server Side Rendering)

Hello! I have a problem with ng-scrollreveal in Angular 4. It actually works fine in local dev environment, but on ng build --prod once it builds the app and once it's on a live server, it returns errors ERROR ReferenceError: ScrollReveal is not defined and ERROR Error: Uncaught (in promise): ReferenceError: ScrollReveal is not defined ReferenceError: ScrollReveal is not defined and it's not working.

I have included NgsRevealModule in my app.module.ts, and as I said, it works all fine with ng serve command. I am quite new in Angular, so I might be missing something? Thanks in advance and thank you for this amazing module

#Edit
Also I've been using angular-ssr for server side rendering, and once build is done I usually run a command so it renders out routes as pages, since it's a small app and only has 4-5 pages I didn't set it to be on-demand rendering, but rather this simple solution. But as I run the command, the terminal also returns an error Unhandled Promise rejection: ScrollReveal is not defined ; Zone: <root> ; Task: Promise.then ; Value: { ReferenceError: ScrollReveal is not defined

Question, Can I use ng-scrollreveal with Loops

Hello,
I'm trying to use ng-scrollreveal with Angular2 NgFor, but it seems not working.
My guess is that ng-scrollreveal is only instantiate once the component is created.
So, how can I re-instantiate it after doing NgFor?

Thanks,
Ahmed Mohamed

Is this ngx-scrollreveal is free for commercial use ?

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

Versions

Repro steps

The log given by the failure

Desired functionality

Mention any other details that might be useful

Wrong reveal/hide behaviour!!

When i load page for first time,after scrolling down my divs are automatically hidden.
But after i refresh/reload my page the issue is gone.
I tried number of ways to eliminate it but was not successfully in doing so.

Screenshot from 2019-04-09 08-06-53

Kindly suggest solution.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

How can I use it with lazy module?

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X ] feature request

OS and Version?

Versions

Desired functionality

Mention any other details that might be useful

Hi,
I just wanted to know how to install the module for lazy modules. It seems to work otherwise but when I use it in Lazy Modules, the dom elements I try to animate remain hidden with opacity 0. I can't see any error in the console.
I tried to add .forRoot() to the import but I got the error saying that this property does not exist.
I hope you can help.
Thanks

Christele

Unable to inject ngs-reveal-config service in root component

Hey @tinesoft
I am having an issue injecting the config service in my root component so that I may provide default values for all the nsReveal directives in my app.

In my app.component.ts:

import { NgsRevealConfig } from 'ng-scrollreveal';

Similarly attempting to add it to my app.module.ts:

import { NgsRevealModule, NgsRevealConfig } from 'ng-scrollreveal';

I'm not sure what I am doing wrong, I'd really appreciate your help!

Installation instructions for Angular 6

Hey,

Love this directive thanks for publishing it! Just wanted to bring it up-to-date with Angular today.

Was just trying to get it going with a fresh Angular 6 project. I found a lot of the steps in the installation instructions can be skipped:

All you need to do to get it working is...

npm install --save ng-scrollreveal

Then import to the main module

import {NgsRevealModule} from 'ng-scrollreveal';
 
@NgModule({
  declarations: [AppComponent, ...],
  imports: [NgsRevealModule.forRoot(), ...],  
  bootstrap: [AppComponent]
})
export class AppModule {
}

and finally in index.html before the closing tag.

<script src="https://unpkg.com/scrollreveal/dist/scrollreveal.min.js"></script>


Hopefully this helps someone, also let me know if you see any problems with my method.

Cheers

OS and Version?

OS X High Sierra

Versions

Angular CLI: 6.0.8
Node: 10.5.0
OS: darwin x64
Angular: 6.0.6

Desired functionality

Up-to-date installation instructions.

Scrollreveal with custom scrollbar like ng-perfect-scrollbar

Is it possible to reveal elements on scroll with a custom scrollbar? I have created a callback for when the visitor scrolls in the web page, but can't find a way to reveal the items. So far I know there is no helpful documentation about NgsRevealService (.reveal())

`constructor(revealConfig: NgsRevealConfig, private revealService: NgsRevealService, private elementRef: ElementRef) {

}

public onCustomScroll(event: any): void {
    var hElement: HTMLElement = this.elementRef.nativeElement;
    var allDivs = hElement.getElementsByClassName('scrollReveal');

    this.revealService.reveal(this.elementRef.nativeElement, this.revealConfig);
}`

ScrollReveal is not defined

  • OS: ElCapitan 10.11.3
  • Browser: Chrome 53.0.2785.143 (64-bit)
  • scrollreveal: ^3.3.2
    ng2-scrollreveal: ^1.0.0

I installed npm scrollreveal and ng2-scrollreveal for my Angular2 app.
The app consists of three sections: Home, About, Contact
I want the About section stuff to be revealed, then following the official guide I add to my div class "item" and set the attribute [ngsReveal]="{ reset: true}"

When I click either Home or Contact sections (where's no content for revealing) console shows no errors, but when I click About section (where's my content to be revealed on scroll) console shows me following errors

screenshot 2016-11-17 23 07 14

My app.module.ts file:
`import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { NgsRevealModule } from 'ng2-scrollreveal';
import { AppComponent } from './app.component';

import { AppRoutingModule, routingComponents } from './app.routing';

@NgModule({
declarations: [ AppComponent, routingComponents ],
imports: [ NgsRevealModule.forRoot(), BrowserModule, AppRoutingModule ],
bootstrap: [ AppComponent ]
})
export class AppModule { }`

My system.config.js file
`import { Component } from '@angular/core';
import { NgsRevealModule } from 'ng2-scrollreveal';

@component({
selector: 'about-block',
providers: [ NgsRevealModule ],
templateUrl: 'app/about.component.html'
})

export class AboutComponent {}`

My about.component.html file
`(function (global) {
System.config({
paths: {
'npm:': 'node_modules/'
},

  map: {
  app: 'app',

  '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
  '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
  '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
  '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
  '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
  '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
  '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
  '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',

  'ng2-scrollreveal': 'npm:ng2-scrollreveal/bundles/ng2-scrollreveal.min.js',
  'rxjs': 'npm:rxjs',
  'angular-in-memory-web-api': 'npm:angular-in-memory-web-api'
},

packages: {
  app: {
    main: './main.js',
    defaultExtension: 'js'
  },
  rxjs: {
    defaultExtension: 'js'
  },
  'angular-in-memory-web-api': {
    main: './index.js',
    defaultExtension: 'js'
    }
  }
});

})(this);`

P.S. Earlier there was an error about ng-2 scrollreveal too, but I manually updated the system.config file inserting the line:
'ng2-scrollreveal': 'npm:ng2-scrollreveal/bundles/ng2-scrollreveal.min.js',

Doing the same with scrollreveal doesn't work and console keeps throwing the same error.
Please, help figure out what's been done wrong.

[Angular] Can't bind to 'ngsSelector' since it isn't a known property of 'div'.

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

macOS(Sierra)

Versions

Angular CLI: 6.0.0
Node: 8.9.3
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@angular/cdk 6.4.7
@angular/flex-layout 6.0.0-beta.16
@angular/material 6.4.7
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0

Repro steps

Following the tutorial specified in this repo.

The log given by the failure

[Angular] Can't bind to 'ngsSelector' since it isn't a known property of 'div'.

Desired functionality

It is unclear what is missing. I imported all necessary modules as specified in the readme still it didn't work. Am I missing something?

Mention any other details that might be useful

ScrollReveal is not defined in Angular CLI: 1.5.4

Getting the following error when i run ng serve

webpack-internal:///../../../core/esm5/core.js:1546 ERROR Error: Uncaught (in promise): ReferenceError: ScrollReveal is not defined
ReferenceError: ScrollReveal is not defined
at new NgsRevealService (webpack-internal:///../../../../ng-scrollreveal/services/ngs-reveal.service.js:21)
at _createClass (webpack-internal:///../../../core/esm5/core.js:10820)
at createProviderInstance$1 (webpack-internal:///../../../core/esm5/core.js:10792)
at resolveNgModuleDep (webpack-internal:///../../../core/esm5/core.js:10777)
at NgModuleRef
.get (webpack-internal:///../../../core/esm5/core.js:12002)
at resolveDep (webpack-internal:///../../../core/esm5/core.js:12498)
at createClass (webpack-internal:///../../../core/esm5/core.js:12362)
at createDirectiveInstance (webpack-internal:///../../../core/esm5/core.js:12207)
at createViewNodes (webpack-internal:///../../../core/esm5/core.js:13645)
at callViewAction (webpack-internal:///../../../core/esm5/core.js:14077)
at new NgsRevealService (webpack-internal:///../../../../ng-scrollreveal/services/ngs-reveal.service.js:21)
at _createClass (webpack-internal:///../../../core/esm5/core.js:10820)
at createProviderInstance$1 (webpack-internal:///../../../core/esm5/core.js:10792)
at resolveNgModuleDep (webpack-internal:///../../../core/esm5/core.js:10777)
at NgModuleRef
.get (webpack-internal:///../../../core/esm5/core.js:12002)
at resolveDep (webpack-internal:///../../../core/esm5/core.js:12498)
at createClass (webpack-internal:///../../../core/esm5/core.js:12362)
at createDirectiveInstance (webpack-internal:///../../../core/esm5/core.js:12207)
at createViewNodes (webpack-internal:///../../../core/esm5/core.js:13645)
at callViewAction (webpack-internal:///../../../core/esm5/core.js:14077)
at resolvePromise (webpack-internal:///../../../../zone.js/dist/zone.js:824)
at resolvePromise (webpack-internal:///../../../../zone.js/dist/zone.js:795)
at eval (webpack-internal:///../../../../zone.js/dist/zone.js:873)
at ZoneDelegate.invokeTask (webpack-internal:///../../../../zone.js/dist/zone.js:425)
at Object.onInvokeTask (webpack-internal:///../../../core/esm5/core.js:4816)
at ZoneDelegate.invokeTask (webpack-internal:///../../../../zone.js/dist/zone.js:424)
at Zone.runTask (webpack-internal:///../../../../zone.js/dist/zone.js:192)
at drainMicroTaskQueue (webpack-internal:///../../../../zone.js/dist/zone.js:602)
at

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Cannot find namespace 'scrollReveal'

- [x] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

macOS(Yosemite)

Versions.

Output from: ng --version:

@angular/cli: 1.4.5
node: 7.10.0
os: darwin x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.5
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript: 2.3.4

Repro steps.

I followed the installation steps as described:

  1. install 'scrollreveal', 'ng-scrollreveal' and '@types/scrollreveal'
  2. added to my app.module.ts like "import { NgsRevealModule } from 'ng-scrollreveal';"
  3. used in app.component.ts as:
import { Component } from '@angular/core';
import { NgsRevealConfig } from 'ng-scrollreveal';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  providers: [NgsRevealConfig]
})
export class AppComponent {

  constructor(config: NgsRevealConfig) {
    // customize default values of ng-scrollreveal directives used by this component tree
    config.duration = 5000;
    config.easing = 'cubic-bezier(0.645, 0.045, 0.355, 1)';
    config.delay = 2000;
    config.scale = 0.9;
  }

}

My package.json:

{
  "name": "project",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.2.4",
    "@angular/common": "^4.2.4",
    "@angular/compiler": "^4.2.4",
    "@angular/core": "^4.2.4",
    "@angular/forms": "^4.2.4",
    "@angular/http": "^4.2.4",
    "@angular/platform-browser": "^4.2.4",
    "@angular/platform-browser-dynamic": "^4.2.4",
    "@angular/router": "^4.2.4",
    "bootstrap": "^4.0.0-beta.2",
    "core-js": "^2.4.1",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "jquery.easing": "^1.4.1",
    "ng-scrollreveal": "^2.1.0",
    "popper.js": "^1.12.6",
    "rxjs": "^5.4.2",
    "scrollreveal": "^3.3.6",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "1.4.5",
    "@angular/compiler-cli": "^4.2.4",
    "@angular/language-service": "^4.2.4",
    "@types/jasmine": "~2.5.53",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "@types/scrollreveal": "0.0.3",
    "codelyzer": "~3.2.0",
    "jasmine-core": "~2.6.2",
    "jasmine-spec-reporter": "~4.1.0",
    "karma": "~1.7.0",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~3.2.0",
    "tslint": "~5.7.0",
    "typescript": "~2.3.3"
  }
}

The log given by the failure.

ERROR in /Users/app/Documents/AngularProjects/project/node_modules/ng-scrollreveal/services/ngs-reveal.service.d.ts (9,19): Cannot find namespace 'scrollReveal'.
ERROR in /Users/app/Documents/AngularProjects/project/node_modules/ng-scrollreveal/services/ngs-reveal.service.d.ts (27,63): Cannot find namespace 'scrollReveal'.
ERROR in /Users/app/Documents/AngularProjects/project/node_modules/ng-scrollreveal/services/ngs-reveal.service.d.ts (35,109): Cannot find namespace 'scrollReveal'.
ERROR in /Users/app/Documents/AngularProjects/project/node_modules/ng-scrollreveal/services/ngs-reveal.service.d.ts (1,1): Cannot find type definition file for 'scrollreveal'.

Desired functionality.

No build error :)

Angular 4.4.5+

OS and Version: Windows 10
ng --version: 1.4.3

Get
+-- UNMET PEER DEPENDENCY @angular/[email protected]
+-- UNMET PEER DEPENDENCY @angular/[email protected]
on $ npm install --save ng-scrollreveal. Same on 4.4.5. Is this library not compatible with newer versions of Angular 4?

Demo not working

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

Versions

Repro steps

The log given by the failure

Desired functionality

Mention any other details that might be useful

Demo is not working when I clicked the link

Cannot find type definition file for 'scrollreveal'

Hi, I encountered these errors below in terminal during ng serve but somehow it works in browser. Any idea how to solve this?

node_modules/ng2-scrollreveal/ngs-reveal.service.d.ts:1:1
Cannot find type definition file for 'scrollreveal'

ng2-scrollreveal/ngs-reveal.service.d.ts:17:63
Cannot find namespace 'scrollReveal'.

ng2-scrollreveal/ngs-reveal.service.d.ts:25:109
Cannot find namespace 'scrollReveal'.

Cannot use NgsRevealModule Module in Angular 16

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

OS and Version?

Versions

MacOS Big Sur 11.6

Angular CLI: 16.1.1
Node: 18.13.0
Package Manager: npm 8.19.3
OS: darwin x64

Angular: 16.1.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1601.1
@angular-devkit/build-angular 16.1.1
@angular-devkit/core 16.1.1
@angular-devkit/schematics 16.1.1
@angular/cli 16.1.1
@schematics/angular 16.1.1
rxjs 7.8.1
typescript 5.1.3

Repro steps

  • npm install --save scrollreveal
  • npm install --save ngx-scrollreveal
  • In angular.json add this line
    "scripts": [
    "node_modules/scrollreveal/dist/scrollreveal.js"
    ]
  • Add in your feature Module.
    import { NgsRevealModule } from 'ngx-scrollreveal';
    ...
    imports: [NgsRevealModule]

Run the app:

  • ng serve

The log given by the failure

Error: src/app/app.module.ts:15:5 - error NG6002: 'NgsRevealModule' does not appear to be an NgModule class.

NgsRevealModule,
   ~~~~~~~~~~~~~~~

node_modules/ngx-scrollreveal/ngs-reveal.module.d.ts:6:22

export declare class NgsRevealModule {
                       ~~~~~~~~~~~~~~~
This likely means that the library (ngx-scrollreveal) which declares NgsRevealModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

From Angular 15 I get this when compiling.

Generating browser application bundles (phase: setup)...Processing legacy "View Engine" libraries:

  • ngx-scrollreveal [es2015/esm2015] (git://github.com/tinesoft/ngx-scrollreveal.git)
    Encourage the library authors to publish an Ivy distribution.

Issues with config.container

Hi there,

I'm having issues with ng-scrollreveal, please see attached image of the issue

Using chrome dev tools with the view responsive (or just changing the browser window size), if I play around with the dimensions (height of the view/browser) it works, but when I scroll, it does not work.

issue

My dependencies and code:

@angular: ^4.0.0
"ng-scrollreveal": "^2.0.2",

app.component.ts

@NgModule({
  declarations: [
   
  ],
  imports: [ 
    NgsRevealModule.forRoot()
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

app.component.html

<!--<layout></layout>-->
 
<style>
    .item {
        width: 50px;
        height: 50px;
        background-color: red;
        padding: 10px;
        margin: 10px;
    }
</style>



<div class="item" [ngsReveal]="{ reset: true}" >..</div>

<div class="item" [ngsReveal]="{ reset: true}" >..</div>

<div class="item" [ngsReveal]="{ reset: true}" >..</div>

<div class="item" [ngsReveal]="{ reset: true}" >..</div>

<div class="item" [ngsReveal]="{ reset: true}" >..</div>

<div class="item" [ngsReveal]="{ reset: true}" >..</div>


<div class="itemset" [ngsRevealSet]="{reset:true}" [ngsSelector]="'.item'">
    <div class="item item1">Item 1</div>
    <div class="item item2">Item 2</div>
    <div class="item item3">Item 3</div>
    <div class="item item4">Item 4</div>
    <div class="item5">Item 5 (will not be animated)</div>
</div>

THANKS !

ngsRevealSet origin no difference ?

Hi,
I'm using ngsRevealSet origin to make my image ease in from right to left, seems the setting on Origin not working? There is no difference when I change it.
[ngsRevealSet]="{ reset: true, origin: 'right', viewOffset: { left: 100} }" [ngsSelector]="'.img-reveal'"

Thanks for giving any idea!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.