Urigo / angular-meteor

Angular and Meteor - The perfect stack
https://www.angular-meteor.com/
MIT License
2.36k stars 622 forks source link

New project with Angular 6; MeteorCLI or Meteor with Angular CLI? #1932

Closed mattiLeBlanc closed 6 years ago

mattiLeBlanc commented 6 years ago

This is not a real issue, other then that I miss some clarity in which example to follow now with latest Meteor and Angular 6.

My last project, I used A5 ang angular-compilers, and then I was pointed at using Angular CLI (as it was much better: https://github.com/Urigo/angular-meteor/tree/master/examples/angularcli-meteor). But after a couple of months of absence, I see that there is another project called MeteorCLI which doesn't require me to install and eject stuff out of NG CLI.

So before I start and get into trouble, which is the recommend way to work with Meteor, Angular 6, Rxjs and Mongo. Is that MeteorCLI or angularcli-meteor?

Maybe it would be good to move examples that are deprecated to a deprecated folder with explanation why they are deprecated.

Currently there are so many examples with different folder layouts , import folders everywhere. It get's very confusing for someone to get into Meteor with A6.

What I love about Angular 6 is that is it build so well and also documented so well. When combining it with Meteor, it feels a bit flaky because the angular-meteor implementation seems to be in constant flux. I am having trouble introducing this at work since it needs to be production stable. I love the work you guys are doing, and if I can contribute in writing docs or anything else, I am happy to help.

Cheers

georgyberdyshev commented 6 years ago

Hello @mattiLeBlanc, it depends on your preference to either work in an Angular or Meteor environment. Specifically in regard to testing, building and deployment.

For example, if you rely on Meteor CLI, you can easily integrate your deployment process with https://github.com/zodern/meteor-up

Otherwise, you rely on the tools around Angular CLI, that help you to develop, analyze and build your code.

As there were some changes for both Angular 6 and Rxjs, the example using Angular CLI have not yet been updated.

If you like to use Meteor CLI, you can use my PR: #1927 All the Meteor CLI examples have been updated to use Meteor 1.7.0.3 with Angular 6.0.7

There are some outstanding changes in this PR, that are specific to Travis CI and running the test suite. Those should not hinder you from running the Meteor CLI examples successfully.

Georgy

mattiLeBlanc commented 6 years ago

@georgyberdyshev I used to very much like MeteorUp, and then it was kind off discontinued. Glad to hear it is back up again, because that made deploying to AWS very easy.

Personally, I found the Angular CLI method with creating an API folder a bit strange. It would be nice if Meteor CLI could proxy Angular CLI in some fashion so that you can install Angular in your Meteor and use all familiar commands. I have no clue if that is achievable or not.

I think the beauty of Meteor was and still is it's CLI and MeteorUp fits nicely in. But I would like to see proper typing and all behaviour that I am used to when using the Angular CLI. I hope now that Angular has settled in, the Meteor team can adopt a best practice for Angular 6 and make it easy to get on board as a developer with having to debug and figure out how to get your app working.

ardatan commented 6 years ago

I am closing this issue but you can still discuss here. Here is another project for integration of meteor and webpack that is used by Angular CLI. https://github.com/ardatan/meteor-webpack

mattiLeBlanc commented 6 years ago

Okay, I got my example to work with MeteorCLI.

Do we now use MongoObservable as in the Meteor Angular CLI example (like it) and using normal RXJS, or do we use import { MeteorObservable } from 'meteor-rxjs'; and MeteorObservable.subscribe? Is that if you want create publishers you use MeteorObservable (like we did with angular 1.x) and if you want more Angular style you use the MongoObservable directly?

**edit so far I only got the MeteorObservable to allow me to render a list of a Mongo Collection. When using the MongoObservable, I got an empty return. Ill keep tinkering :)

mattiLeBlanc commented 6 years ago

@ardatan I am working with NGRX, do you know why I have to use @Inject to get rid of the error

Uncaught (in promise): Error: Can't resolve all parameters for ChannelsEffects: (?, ?).

My channelEffect constructor:

@Injectable()
export class ChannelsEffects {
  constructor(
    @Inject( Actions ) private actions$: Actions,
    @Inject( fromServices.ChannelsService) private channelService: fromServices.ChannelsService,
   ) {

  }

I know using the @Inject makes stuff work but I don't understand why I need this in my Angular Meteor project. I have declared the providers in my feature module which works with a normal NG CLI Product. I also have the reflect polyfill enabled.