thinktecture / boardz-cross-platform-sample

Sample application for demonstrating various aspects of modern cross-platform applications - using Angular 2, Cordova, Electron & gulp. With a .NET Web API & SignalR backend.
MIT License
78 stars 30 forks source link

Add angularfire2 #61

Closed cissecedric closed 7 years ago

cissecedric commented 7 years ago

Hi,

I am struggling trying to add angularfire2 to this project, I get this error: Error: Error: XHR error (404 Not Found) loading http://localhost:8000/angularfire2(…)

Is it currently possible to do this, or should I wait for an update? Thanks,

ManuelRauber commented 7 years ago

Hi @cissecedric

It seems, that you have not added angularfire2 to the build process. I've never used it, so I just guess, what you need to do to add it to your project.

If it is installed via npm, you need to add the dependency in the gulp config. Append an entry like ./node_modules/angularfire2/**/*. Then you need to create a gulp task similar to the [private-web]:copy-angular2-scripts gulp task within web.js, like this:

gulp.task('[private-web]:copy-angular2-scripts', function () {
            return gulp.src(config.source.files.angularfire2)
                .pipe(gulp.dest(path.join(config.targets.buildFolder, 'angularfire2')));
        });

Then you need to add this new task to the runSequence config shown here

Last but not least, you need to configure SystemJS to load angularfire2. You can do this by adding a mapping like

'angularfire2: 'angularfire2/bundles/angularFire2.umd.js'

After that, you can start the project again and angularfire2 should be able to load.

cissecedric commented 7 years ago

Great, it works!! (and I had to do the same with firebase),
Thank you for your precises and detailed information. I wouldn't have found without it, Regards,