GithubHelp home page GithubHelp logo

ngx-twitter-timeline's Introduction

Embed Twitter Timeline in Angular application.

Installation

To install this library, run:

$ npm install ngx-twitter-timeline --save

Usage

Import in AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import ngx-twitter-timeline
import { NgxTwitterTimelineModule } from 'ngx-twitter-timeline';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    // Specify library as an import
    NgxTwitterTimelineModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once the library is imported, you can use its component in your Angular application:

<!-- You can now use the library component in app.component.html -->
<ngx-twitter-timeline 
	[data]="{sourceType: 'url', url: 'https://twitter.com/twitterdev'}"
	[opts]="{tweetLimit: 5}"
></ngx-twitter-timeline>

Data

Data can take value of url or profile.
If url is set, you have to provide a valid Twitter URL;
If profile is set, you have to set screenName as a valid Twitter screen name. E.g. @twitterdev

url and screenName are mutually exclusive.

NgxTwitterTimelineData {
  /**
   * profile or URL
   */
  sourceType: string;
  /**
   * Valid Twitter username
   */
  screenName?: string;
  /**
   * Absolute URL of a Twitter profile, likes, list, or collection
   */
  url: string;
}

Options

NgxTwitterTimelineOptions {
  /**
   * Render a timeline statically, displaying only n number of Tweets.
   * Range: 1-20
   */
  tweetLimit?: number;
  /**
   * Set a fixed height of the embedded widget
   * Positive integer
   */
  height?: number;
  /**
   * Adjust the color of borders inside the widget.
   * Hexadecimal color
   */
  borderColor?: string;
  /**
   * Sets the theme of the widget. Default = 'light'.
   * 'light' or 'dark'
   */
  theme?: string;
  /**
   * Toggle the display of design elements in the widget. This parameter is a space-separated list of values
   * Values: noheader, nofooter, noborders, transparent, noscrollbar
   */
  chrome?: string[];
  /**
   * Apply the specified aria-polite behavior to the rendered timeline.
   * New Tweets may be added to the top of a timeline, affecting screen readers
   * Values: polite, assertive, rude
   */
  ariaPolite?: string[];
}

License

MIT © 2017 Bogdan Dinga

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ngx-twitter-timeline's People

Contributors

featured14 avatar

Stargazers

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

Watchers

 avatar  avatar

ngx-twitter-timeline's Issues

0.1.5 version doesn't supports Angular 5 code snippet

Error :

ERROR in Error during template compile of 'AppModule'
  Function calls are not supported in decorators but 'NgxTwitterTimelineModule' was called.
src/app/app.module.ts: error TS2339: Property 'forRoot' does not exist on type 'typeof NgxTwitterTimelineModule'.

to use .forRoot() in Angular 5 project, we should use 0.1.4 version.
I think this should have mentioned in README file.

Not working with angular 6

I am getting the following error while used with Angular 6: -

ERROR in node_modules/ngx-twitter-timeline/twitter-timeline.service.d.ts(1,10): error TS2305: Module '"/home/xxxx/Documents/Projects/xxxx/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
Could you please suggest me a solution?

Could you please update to Angular 8, 9, 10 please !

Hello,

Let start with thanking you about this nice soultion !

i'm trying to upgrade my project angular version; and i'm having the below dependencies issuues
Package "ngx-twitter-timeline" has an incompatible peer dependency to "@angular/core" (requires "^7.2.0" (extended), would install "9.1.11").

Package "ngx-twitter-timeline" has an incompatible peer dependency to "@angular/common" (requires "^7.2.0" (extended), would install "9.1.11").

Could you please update tp angular 8, 9 & 10 please ?

Tweet Disappears in Mat-Tab

I am using" ngx-twitter-timeline" in my web page which is written in angular 6. I am trying to create a Mat-tab in my page and one of the tab has this twitter embed.

<ngx-twitter-timeline [data]="{sourceType: 'url', url: 'someTwitterUrl" [opts]="{tweetLimit: 5}">

When i load the page for the first time it is working fine. But if i go to the next tab and get back to this twitter tab the tweets are disappeared.

Kindly help me to resolve this.

Set target/Disable links

Is there a way that we can stop links from the embedded timeline from opening and taking over the app?

I am using this library in my Ionic 4 app and currently if you tap on the timeline on a mobile device, Twitter takes over the app. See the gif below for a recording of what's happening.

Imgur

Which API URLs does the app call?

I am trying to use this in my Ionic app but I am forced to whitelist URLs that the app can call... Currently I have to whitelist all URLs to use this library. Can I get a list of API urls that are called by this library so I can white list them?

Peer Dependencies vs. Dev Dependencies

Upon install the package warns of requiring a peer dependency of @angular/core@^4.0.0. However, from looking at your root package.json, it seems you defined the devDependcies of @angular to be ^5.0.0. Shouldn't the dev and peer dependencies match versions between the two libraries?

sandbox not initialized

sandbox not initialized

Script throws error when current route that initialized the component is navigated away from. No trigger or on destroy in documentation to stop it from loading the underlying js script.

How to use this for hashtags

I am trying to embed hashtags into it. And i see the following error:

Unhandled Promise rejection: this.params.dataSource.fetch is not a function ; Zone: ; Task: Promise.then ; Value: TypeError: this.params.dataSource.fetch is not a function

@ABD-DEV Need help on this

Can't Customize the CSS code

I tried to set height for - .timeline-Viewport class but its not working
.SandboxRoot.var-fully-expanded .timeline-Viewport {
height: 400px
}

this.params.dataSource.fetch is not a function

I had this component loaded into my Ionic 4 app earlier this year.
After some Angular and Ionic Cli updates earlier the other month I get the following error and nothing displayed on the page:

zone.js:682 Unhandled Promise rejection: this.params.dataSource.fetch is not a function ; Zone: <root> ; Task: Promise.then ; Value: TypeError: this.params.dataSource.fetch is not a function at e.<anonymous> (timeline.4c6ab682148a0366f9efb1647a3f4799.js:1) at e.hydrate (widgets.js:8) at c.hydrate (widgets.js:8) at widgets.js:8 at Array.forEach (<anonymous>) at widgets.js:8 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (zone.js:150) at zone.js:889 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195) at drainMicroTaskQueue (zone.js:601) TypeError: this.params.dataSource.fetch is not a function at e.<anonymous> (https://platform.twitter.com/js/timeline.4c6ab682148a0366f9efb1647a3f4799.js:1:14330) at e.hydrate (https://platform.twitter.com/widgets.js:8:28972) at c.hydrate (https://platform.twitter.com/widgets.js:8:23168) at https://platform.twitter.com/widgets.js:8:8257 at Array.forEach (<anonymous>) at https://platform.twitter.com/widgets.js:8:8228 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (http://localhost:8100/polyfills.js:2749:26) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (http://localhost:8100/polyfills.js:2508:43) at http://localhost:8100/polyfills.js:3247:34 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (http://localhost:8100/polyfills.js:2781:31) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (http://localhost:8100/polyfills.js:2553:47) at drainMicroTaskQueue (http://localhost:8100/polyfills.js:2959:35)

as I am currently writing my bachelor's degree on this, I would be really happy if any of you have a solution for the problem. I've googled a lot and couldn't find an event remotely similar error anywhere.

Here is my ionic info output for reference as well:
``
Ionic:

ionic (Ionic CLI) : 4.12.0
Ionic Framework : @ionic/angular 4.3.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.2.4
@angular/cli : 7.3.8
@ionic/angular-toolkit : 1.5.1

Cordova:

cordova (Cordova CLI) : 9.0.0 ([email protected])
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 13 other plugins)

System:

NodeJS : v10.15.0 (C:\Development\nodejs\node.exe)
npm : 6.8.0
OS : Windows 10
``

Is this dead? angular 6

Is this repo getting updated still or is it dead? I notice there has been a issue open for a while with no comments or anything.

I would like to have this updated for Angular 6, #6

It shouldn't be hard to update this, but I also see the PR #8 has been open for a while as well

If you are not looking to keep this updated, I would be happy to take over.

Protected tweets

Hi,
is it possible to display a protected twitter timeline? It's not mentioned.

Observable import error

Hi @ABD-DEV ,
I have this error:

app_1 | ERROR in ./node_modules/ngx-twitter-timeline/index.js app_1 | Module not found: Error: Can't resolve 'rxjs/Observable' in '/usr/src/app/node_modules/ngx-twitter-timeline'

Version:

  • angular/core: 6.0.7,
  • angular/cli: 6.0.8,
  • rxjs: 6.2.1

Change ngOnInit to ngOnChanges

Right now if the input url changes, the component does not update. The lifecycle method should be changed so we don't have to completely re-instantiate the component to get it to update.

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.