Skip to content

Commit

Permalink
examples(angular2): Added angular2+meteor-ngrx with OnPush example
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Nov 3, 2016
1 parent 7c034f1 commit 9d97b51
Show file tree
Hide file tree
Showing 23 changed files with 359 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/angular2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
.meteor/local
npm-debug.log
typings
.idea
.meteor/local
16 changes: 16 additions & 0 deletions examples/angular2/.meteor/.finished-upgraders
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file contains information which helps Meteor properly upgrade your
# app when you run 'meteor update'. You should check it into version control
# with your project.

notices-for-0.9.0
notices-for-0.9.1
0.9.4-platform-file
notices-for-facebook-graph-api-2
1.2.0-standard-minifiers-package
1.2.0-meteor-platform-split
1.2.0-cordova-changes
1.2.0-breaking-changes
1.3.0-split-minifiers-package
1.3.5-remove-old-dev-bundle-link
1.4.0-remove-old-dev-bundle-link
1.4.1-add-shell-server-package
2 changes: 2 additions & 0 deletions examples/angular2/.meteor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dev_bundle
local
7 changes: 7 additions & 0 deletions examples/angular2/.meteor/.id
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file contains a token that is unique to your project.
# Check it into your repository along with the rest of this directory.
# It can be used for purposes such as:
# - ensuring you don't accidentally deploy one app on top of another
# - providing package authors with aggregated statistics

a4kqps1d5y31214lew0l
24 changes: 24 additions & 0 deletions examples/angular2/.meteor/packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.

[email protected] # Packages every Meteor app needs to have
[email protected] # Packages for a great mobile UX
[email protected] # The database Meteor supports right now
[email protected] # Reactive variable for tracker
[email protected] # Meteor's client-side reactive programming library

[email protected] # CSS minifier run for production mode
[email protected] # JS minifier run for production mode
[email protected] # ECMAScript 5 compatibility for older browsers.

[email protected] # Publish all data to the clients (for prototyping)
[email protected] # Allow all DB writes from clients (for prototyping)
angular2-compilers
practicalmeteor:mocha
xolvio:cleaner
hwillson:stub-collections
dispatch:mocha-phantomjs
[email protected]
2 changes: 2 additions & 0 deletions examples/angular2/.meteor/platforms
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server
browser
1 change: 1 addition & 0 deletions examples/angular2/.meteor/release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[email protected]
89 changes: 89 additions & 0 deletions examples/angular2/.meteor/versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
barbatus:[email protected]
barbatus:[email protected]
barbatus:[email protected]
barbatus:[email protected]
barbatus:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]_2
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
dispatch:[email protected]
dispatch:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
hwillson:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]_2
[email protected]
[email protected]
practicalmeteor:[email protected]_1
practicalmeteor:[email protected]_2
practicalmeteor:[email protected]_6
practicalmeteor:[email protected]
practicalmeteor:[email protected]_2
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
tmeasday:[email protected]
[email protected]
[email protected]
[email protected]
urigo:[email protected]
[email protected]
[email protected]
[email protected]
xolvio:[email protected]
4 changes: 4 additions & 0 deletions examples/angular2/both/collections/demo.collection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { MongoObservable } from "meteor-rxjs";
import {Demo} from "../models/demo.model";

export const DemoCollection = new MongoObservable.Collection<Demo>("demo-collection");
4 changes: 4 additions & 0 deletions examples/angular2/both/models/demo.model.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface Demo {
name: string;
age: number;
}
10 changes: 10 additions & 0 deletions examples/angular2/client/imports/app/app.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div>
<h1>Angular 2 with Meteor-RxJS Example</h1>
<br/>
Items:
<ul>
<li *ngFor="let item of items | async">
{{ item._id }}
</li>
</ul>
</div>
3 changes: 3 additions & 0 deletions examples/angular2/client/imports/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
app {

}
18 changes: 18 additions & 0 deletions examples/angular2/client/imports/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {Component, ChangeDetectionStrategy} from "@angular/core";
import template from "./app.component.html";
import style from "./app.component.scss";
import {MeteorObservable} from "../../../../../src/MeteorObservable";
import {DemoCollection} from "../../../both/collections/demo.collection";

@Component({
selector: "app",
template,
styles: [ style ],
changeDetection: ChangeDetectionStrategy.OnPush
})
export class AppComponent {
items = DemoCollection.find({});

constructor() {
}
}
29 changes: 29 additions & 0 deletions examples/angular2/client/imports/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { AppComponent } from "./app.component";

@NgModule({
// Components, Pipes, Directive
declarations: [
AppComponent
],
// Entry Components
entryComponents: [
AppComponent
],
// Providers
providers: [

],
// Modules
imports: [
BrowserModule
],
// Main Component
bootstrap: [ AppComponent ]
})
export class AppModule {
constructor() {

}
}
2 changes: 2 additions & 0 deletions examples/angular2/client/imports/app/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./app.component";
export * from "./app.module";
6 changes: 6 additions & 0 deletions examples/angular2/client/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<head>
<base href="/">
</head>
<body>
<app>Loading...</app>
</body>
12 changes: 12 additions & 0 deletions examples/angular2/client/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import "angular2-meteor-polyfills";

import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
import { enableProdMode } from "@angular/core";
import { Meteor } from "meteor/meteor";
import { AppModule } from "./imports/app";

enableProdMode();

Meteor.startup(() => {
platformBrowserDynamic().bootstrapModule(AppModule);
});
3 changes: 3 additions & 0 deletions examples/angular2/client/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
body, html {

}
37 changes: 37 additions & 0 deletions examples/angular2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "angular2-meteor-rxjs-example",
"private": true,
"scripts": {
"start": "meteor run",
"start:prod": "meteor run --production",
"build": "meteor build ./build/",
"clear": "meteor reset",
"meteor:update": "meteor update --all-packages",
"test": "meteor test --driver-package practicalmeteor:mocha",
"test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
},
"devDependencies": {
"@types/chai": "^3.4.33",
"@types/mocha": "^2.2.32",
"chai": "3.5.0",
"chai-spies": "0.7.1"
},
"dependencies": {
"@angular/common": "2.1.2",
"@angular/compiler": "2.1.2",
"@angular/core": "2.1.2",
"@angular/forms": "2.1.2",
"@angular/platform-browser": "2.1.2",
"@angular/platform-browser-dynamic": "2.1.2",
"@angular/router": "3.1.2",
"angular2-meteor": "0.7.0",
"angular2-meteor-polyfills": "0.1.1",
"angular2-meteor-tests-polyfills": "0.0.2",
"meteor-node-stubs": "0.2.3",
"meteor-rxjs": "../../",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26",
"meteor-typings": "1.3.1"
}
}
26 changes: 26 additions & 0 deletions examples/angular2/server/imports/server-main/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {DemoCollection} from "../../../both/collections/demo.collection";
import {Demo} from "../../../both/models/demo.model";

export class Main {
start(): void {
this.initFakeData();
}

initFakeData(): void {
if (DemoCollection.find({}).cursor.count() === 0) {
const data: Demo[] = [{
name: "Dotan",
age: 25
}, {
name: "Liran",
age: 26
}, {
name: "Uri",
age: 30
}];
data.forEach((obj: Demo) => {
DemoCollection.insert(obj);
});
}
}
}
4 changes: 4 additions & 0 deletions examples/angular2/server/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Main } from "./imports/server-main/main";

const mainInstance = new Main();
mainInstance.start();
25 changes: 25 additions & 0 deletions examples/angular2/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "es5",
"lib": [
"es6",
"dom"
],
"module": "commonjs",
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"sourceMap": true
},
"exclude": [
"node_modules"
],
"files": [
"typings.d.ts"
],
"compileOnSave": false,
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit": true
}
}
29 changes: 29 additions & 0 deletions examples/angular2/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/// <reference types="zone.js" />
/// <reference types="meteor-typings" />
/// <reference types="@types/underscore" />

declare module "*.html" {
const template: string;
export default template;
}

declare module "*.scss" {
const style: string;
export default style;
}

declare module "*.less" {
const style: string;
export default style;
}

declare module "*.css" {
const style: string;
export default style;
}

declare module "*.sass" {
const style: string;
export default style;
}

0 comments on commit 9d97b51

Please sign in to comment.