GithubHelp home page GithubHelp logo

sstorie / experiments Goto Github PK

View Code? Open in Web Editor NEW
139.0 23.0 207.0 5.42 MB

A repository to capture simple code experiments

TypeScript 1.53% HTML 0.41% CSS 0.08% C# 1.55% JavaScript 96.42% SCSS 0.01%
angular reactiveui reactivex

experiments's Issues

Async Issue

Hi, I've been trying to make the connectionState but it doesn't reflect on the Template

this.connectionState$ = this.channelService.connectionState$
.map((state: ConnectionState) => { return ConnectionState[state]; });

<div>
    <span>Connection state: {{connectionState$ | async}}</span>
</div>

I can check that the connectionState$ changed from console.log but in the template view it's not changing, but when I clicked on a Button that does nothing just a normal button the connectionState$ suddenly shows up.

<button (click)="sample()">Click Me</button>

inside my component
public sample() {
 //nothing in here
}

angular2-child-injectors: another way to write individualChild

Hi SStorie. I appreciate your demos. Thanks for providing them.

This is probably not what you are trying to demonstrate with the angular2-child-injectors project, but another way to solve the problem of the ChildComponent sharing scope:

import {Component} from "angular2/core";

import {IdService} from "./id.service";

@Component( {
    selector: 'child',
    template: `
        <div class="child">
            <span><a href="#" (click)="regenerate()">Regenerate</a></span>
            <span>{{guid}}</span>
        </div>
    `
})
export class ChildComponent {

    guid:string;

    constructor(
        private idService: IdService
    )
    {
        this.regenerate(); 
    }

    regenerate() {
        this.idService.regenerate();
        this.guid = this.idService.id;
    }
}

I was glad I was able to do this without having to perform a deep copy with something strange like this.guid = JSON.parse(JSON.stringify(this.idService.id));

I think this is really interesting too, that you wrote from IndividualChildComponent:

    providers: [
        provide(IdService, { useFactory: () => {
            return () => {
                return new IdService();
            }
        }})
    ]

But there is still something bothering me about them having the individual instances of the same service. Do you think there is a better way?

Good job, thanks again for making things!

messages never update, only displays at end of call in a batch

I've implemented this in Angular 5 but the Task component is never updated but I can see it updating in the console.

private appendStatusUpdate(ev: ChannelEvent): void {
        // Just prepend this to the messages string shown in the textarea
        //
        let date = new Date();
        switch (ev.Data.State) {
            case "starting": {
                this.messages = `${date.toLocaleTimeString()} : starting\n` + this.messages;
                break;
            }

            case "complete": {
                this.messages = `${date.toLocaleTimeString()} : complete\n` + this.messages;
                break;
            }

            default: {

                console.log(ev.Data.PercentComplete);  <--This updates

                /****NOTE : THIS IS NOT UPDATING ******/
                this.messages = `${date.toLocaleTimeString()} : ${ev.Data.State} : ${ev.Data.PercentComplete} % complete\n` + this.messages;    
            }
        }
    }

Missing package.json

Any chance you could add the package.json file to your signalr example (client)?

GET http://localhost:4200/app/main.ts 404 (Not Found)

I am using angular CLI and ATOM editor for coding.

I followed your tutorial. My main.ts code is ad follow

import { platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import { enableProdMode } from '@angular/core';
import { environment } from './environments/environment';
import { AppModule } from './app/app.module';
import {ApiConfig} from './app/api.service';
import {AppComponent} from './app/app.component';


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


export function initApp(apiUrl: string, apiToken:string, apiSession:string){
// make the config ref to start the new running program
  let apiConfig = new ApiConfig();
  apiConfig.apiUrl = apiUrl;
  apiConfig.apiToken = apiToken;
  apiConfig.apiSession = apiSession;

  console.log("Inside the function  api_url :"+apiUrl+" api_token : "+apiToken+"--- sessiontoken : "+apiSession);
}


bootstrap(AppComponent, [
      provide("api.config", {useValue: apiConfig})
  ]); 

 platformBrowserDynamic().bootstrapModule(AppModule);

But i am not able to import


bootstrap(AppComponent, [
      provide("api.config", {useValue: apiConfig})
 ]);

Its not in my @angular package.


My Issue is:
I want to pass accesstoken and sessiontoken to angular app. In the first component (App Component) i want to check (by server api) if user is authorised to access the app.

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.