-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding angular2-chat-app example #436
Conversation
How to use the Horizon client without importing it within the index.html, in NativeScript we do not have an index.html so, I tried to import but not being able yet... any idea? |
@jonathan-casarrubias are you using TypeScript? I think you should be able to do: import * as Horizon from '@horizon/client'; |
Also add |
Yeah I already tried that, I also created a simple definition and added it to the references.d.ts. But when I try to compile I get the following error `app/app.component.ts(2,21): error TS2307: Cannot find module '@horizon/client'.`` so the steps 1.- Created a NativeScript 2 App with Angular2 and TypeScript import {Component} from "@angular/core";
import * as Horizon from '@horizon/client';
@Component({
selector: "my-app",
template: `
<StackLayout>
<Label text="Hello Horizon" class="title"></Label>
</StackLayout>
`,
})
export class AppComponent {} When I visit the @horizon/client folder within the node_modules path, I see there is a dist, lib, package.json and README, but no index at all, so I found the files section within the package.json that actually points to dist and lib, but it does not work when trying to import it. I also tried, to import If I use other 3rd party library like moment I can actually import it by using It is sad because I'm writing a blog post and project for this week about Horizon and NativeScript but this simple issue have me blocked. I will keep playing with it to see if I can get to make it work, thanks in advanced for any help Cheers, |
@jonathan-casarrubias Here are some examples of nativescript running with Horizon https://discuss.horizon.io/t/nativescript-starters-demos/152 |
omg I was so god d*** close, I was trying var Horizon = require("@horizon/client/lib"); when you posted the answer, because in there I see the index.js, which by the way does not work. Now pointing to "@horizon/client/dist/horizon" does compile, thanks a lot @helixten it would be super awesome to have this in the documentation.. I can help if needed.. Also I know TS comes in the next major release, so maybe is not even needed.. Cheers |
The example is not working correctly. There's a bug in chat.component.ts, line 82: should be |
Thanks @poznyakovskiy fixed |
<html> | ||
|
||
<head> | ||
<title>Angular 2 QuickStart</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to change the title so it's no longer 'Angular 2 QuickStart'. And add <!doctype html> to the top?
@zubair-io Is it ok for me to help with anything on this? |
I have looked through this and it all appears to work perfectly apart from the last change suggested by @marcusreese so should be merged in my opinion. |
I can verify that this works on my local horizon setup. However I have to ask something possibly unrelated. Borrowing from the way it works on Meteor project is it possible to transpile, aggregate, minify and possibly uglify all the .ts on server side and keep the individual files in a folder not directly accessible by the client like imports/ ? |
@shantanubhadoria This is why |
@deontologician Thanks for answering. How would I go about transpiling and aggregating .ts on the server side instead of loading individual components seperately on client with imports? |
@shantanubhadoria I think you are looking for a bundler. Try adding webpack or systemjs-bundler |
Sorry for having to create a new pull request for this, my fork some how got disconnected and changes where not showing up.
The changes are:
Updated to angular 2.0.0-rc.1
Removing typings
Moving Horizon to a service
This change is