Firebase Cloud Messaging with ionic Chat App - angularjs

I am developing android/ios chat app using ionic framework and I want to add Push Notification with the help of new firebase feature FCM. simple push notification working fine using this plugin https://github.com/fechanique/cordova-plugin-fcm but now i want to send message to another device how is it works in app. when i write FCMPlugin in App.js face many errors.
Controller.js
angular.module('starter', ['ionic', 'FCMPlugin', 'intlpnIonic', 'ionic-material', 'ngStorage', 'ngCordovaOauth', 'firebase', 'ngCordova'])
Error
ionic.bundle.js:13438 Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module FCMPlugin due to:
Error: [$injector:nomod] Module 'FCMPlugin' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.5.3/$injector/nomod?p0=FCMPlugin
at http://192.168.15.34:8100/lib/ionic/js/ionic.bundle.js:13438:12
at http://192.168.15.34:8100/lib/ionic/js/ionic.bundle.js:15404:17
at ensure

Related

Unable to repro unavailable Angular Module error

Following is how my controller in Angular 1.x looks like -
const app = angular.module("userRegistration", [
"some-dep",
"templates",
"ngRoute",
"ngResource",
"ngCookies",
"userRegistration.controllers",
"userRegistration.services",
"userRegistration.directives"
]);
Everything runs fine but once in a while, the following error surfaces, mostly on a windows machine with Chrome browser version >= 62 -
Uncaught Error: [$injector:modulerr] Failed to instantiate module userRegistration due to: Error: [$injector:nomod] Module 'userRegistration' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
I came to know from another SO post that the issue lies in the syntax. The correct syntax is
var app = angular.module("MesaViewer", []);
But I am not sure why this error never sprang up in past. I tried to repro the issue on the same chrome browser version but was unable to.
Can you pls try this..
const app = angular.module("userRegistration", [
"some-dep",
"templates",
"ngRoute",
"ngResource",
"ngCookies"
]);
There is not need to inject the controller, services, etc from the same module

AngularJS Error - Failed to instantiate module ngIdle

I have an Angular app reporting a persistent error.
Failed to instantiate module ngIdle due to ...
Error: $injector:nomod
Module Unavailable
Module 'ngIdle' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
After manually adding module via npm install ng-idle, I keep getting the error in my browser. I even see angular idle dir in my node-modules directory.
How do I resolve this?
app.js declaration
var app =angular.module('app', ['ngResource', 'LocalStorageModule', 'ui.router', 'kendo.directives', 'datatables' , 'datatables.bootstrap', 'datatables.scroller', 'angularMoment', 'ngAnimate','ngIdle']);
My index.html was missing the following line
<script src="resources/js/idlejs/angular-idle.js"></script>
Adding the line resolved the error.

Module 'lokijs' is not available

I am new in ionic I want to use offline data storage in my app. for that I use lokiJS in my ionic app.
I used "bower install lokijs --save" for add js.
but when I add lokijs dependency in my app.module like
angular.module('starter', ['ionic', 'lokijs'])
then it show error like below:
Error: [$injector:modulerr] Failed to instantiate module lokijs due to:
Error: [$injector:nomod] Module 'lokijs' is not available! You either misspelled the module name or forgot to load it."
How can I fix this issue?

How to initiate a modul in angular js

I am making an app using angular and ionic. I am doing facebook login and I have the following code in app.js init:
var app = angular.module('app', ['... 'ezfb', 'hljs']);
app.config('ezfbProvider', function (ezfbProvider) {
/**
* Basic setup
*
* https://github.com/pc035860/angular-easyfb#configuration
*/
ezfbProvider.setInitParams({
appId: 'iddddddd'
});
});
And I have added a reference to bundle about angular-easyfb.min.js and angular-easyfb.js
But I still get an error on the console saying :
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module hljs due to:
Error: [$injector:nomod] Module 'hljs' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
Whats the problem I don't get it ?
The problem is that you need to have something call angular.module("hljs", [...]) before you can create your own module that depends on "hljs".
I'm guessing that you haven't included a "hljs" angular module, or that you have but the script tag for it does not appear before the script tag for your own module.

AngularJS LocalStorageModule is not available

I'm attempting to get a brand new Ionic project working with angular-local-storage with no luck. I'm somehow referencing angular-local-storage incorrectly, but I don't know how.
https://github.com/grevory/angular-local-storage
ionic start myApp tabs
cd myApp
ionic platform add ios
ionic build ios
bower install angular-local-storage
// app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'LocalStorageModule'])
Then
ionic serve
Error
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module LocalStorageModule due to:
Error: [$injector:nomod] Module 'LocalStorageModule' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
What simple thing am I missing?
I'm not familiar with ionic, but it looks to me like you're missing the script.
Are you sure that you have the script included on the page? I'd confirm that bower did indeed install the script where you think it should be and then make sure its actually referenced before this error is thrown.
Guy should need to check that have you added link to it's script
src="https://rawgit.com/grevory/angular-local-storage/master/dist/angular-local-storage.min.js"
using <script></script> tag in your index file. It might be the issue. For the guys who will see this in future.

Resources