sstorie / experiments Goto Github PK
View Code? Open in Web Editor NEWA repository to capture simple code experiments
A repository to capture simple code experiments
ERROR in /..../..../auto-logout.service.ts (19,28): Property 'asObservable' does not exist on type 'Store<IState>'.
webpack: Failed to compile.
How can I resolve this error?
app/auto-logout.service.ts(19,28): error TS2339: Property 'asObservable' does not exist on type 'Store'.
how to solve this 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
}
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!
Hi there,
Don't know if you have used Autofac (or use some other IoC container) but I am having trouble using your example and getting DI working.
I have created a repo and a stack overflow question but I thought I'd come to you as your tutorial was great and its all working except for this last peice.
SO:
http://stackoverflow.com/questions/37912330/autofac-injection-of-ihubcontext-signalr-mvc
Repo:
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;
}
}
}
Hi.,
What changes would it need to call one of the application services method and bootstrap the same service with the response data on successful response ?
How to build 2 apps. There is no way to build those
Any chance you could add the package.json file to your signalr example (client)?
Getting the exception:
EXCEPTION: Error in http://localhost:3000/app/notification/notification.component.html:0:18"platform-browser.umd.js:1900:17
ORIGINAL EXCEPTION: TypeError: Invalid easing 'null'.
in Firefox. Chrome works fine.
Next thing:
If I click the "toggle-button" in firefox, the action is executed in Chrome
ERROR in Error encountered resolving symbol values statically. Calling function
'ChannelConfig', function calls are not supported. Consider replacing the functi
on or lambda with a reference to an exported function, resolving symbol AppModul
e in mypth/src/app/app.module.ts, resolving
symbol AppModule in mypth/app/app.modu
le.ts
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.
I don't see JQuery setup as a dependency in the config or packages,json. Also, I do not see how signalr is supposed to be registered in the systemjs.config.js. Am I missing something?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.