Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
    <title>Angular 2</title>
    <script src="[email protected]/client/shim.min.js"></script>
    <script src="[email protected]/dist/zone.js"></script>
    <script src="[email protected]/Reflect.js"></script>
    <script src="[email protected]/bundles/Rx.js"></script>

    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>
    <script src=""></script>

    <script src="[email protected]/dist/web/pubnub.js"></script>
    <script src="[email protected]/dist/pubnub-angular2.js"></script>

    <link rel="stylesheet" href="" />
    <link rel="stylesheet" href="" />
    var app = = {};
    app.main_component = ng.core.Component({
        selector: 'main-component',
        template: `
<div class="container">
    NOTE: make sure to update the PubNub keys below with your keys,
    and ensure that the BLOCK settings are configured properly!
    <h3>MyApp BLOCKS Twitter Integration</h3>
    <br />
    <br />
    <input type="text" [(ngModel)]="toSend" placeholder="tweet" />
    <input type="button" (click)="publish()" value="Send!" />
      <li *ngFor="let item of messages.slice().reverse()">
        <div>{{item.message.tweet}} <b>{{}}</b></div>
        constructor: [PubNubAngular, function(pubnubService){
            var self = this;
            self.pubnubService = pubnubService;
            self.channelName = 'twitter-channel';
						self.messages = [];
						self.toSend = "";

                publishKey: 'YOUR_PUB_KEY',
                subscribeKey: 'YOUR_SUB_KEY',

            pubnubService.subscribe({channels: [self.channelName], triggerEvents: true});
            self.messages = pubnubService.getMessage(this.channelName,function(){
              // no handler necessary, dynamic collection of msg objects
        publish: function(){
            this.pubnubService.publish({ channel: this.channelName, message: {tweet:this.toSend} });
            this.toSend = "";

    app.main_module = ng.core.NgModule({
        imports: [ng.platformBrowser.BrowserModule, ng.forms.FormsModule],
        declarations: [app.main_component],
        providers: [PubNubAngular],
        bootstrap: [app.main_component]
        constructor: function(){}

    document.addEventListener('DOMContentLoaded', function(){