Ionic 2 angular-2-in-memory-web-api 404 error - angularjs

I've been developing a simple app in Ionic 2 and I tried using mock service (in-memory web API) for fetching data as described in this Angular 2 tutorial. My console reported this error:
TypeScript error: app/app.ts(11,49): Error TS2307: Cannot find module
'angular2-in-memory-web-api'.
I tried this solution: angular2-in-memory-web-api 404 error. After running this: npm i angular2-in-memory-web-api --save, I was unable to find the files where I was supposed to use the code provided in the rest of the solution.
How can I fix this? Sorry if the question is not posed quite right, this is my first one. Please ask if any additional information is needed. The problem is pretty much the same as the one for which the solution was provided in the link above, except that using Ionic 2 makes the given solution inapplicable in my case. I'm don't think SystemJS is being used, please see my file structure image.
Image of my file structure.

Related

Cant use 'fs' in my react-native project.. don't know how to solve

Hi im trying to use the fs.createReadStream() function in 'fs' however i cant seem to use this module as i keep getting this build error.
bundling failed: Error: While trying to resolve module fs from file /Users/bentait/Desktop/memriio/memriio_app/src/datapass.js, the package /Users/bentait/Desktop/memriio/memriio_app/node_modules/fs/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/bentait/Desktop/memriio/memriio_app/node_modules/fs/index.js. Indeed, none of these files exist:
Im almost at my end trying to learn js, react, react-native.. i seem to spend 90% of time trying to solve these sorts of problems and 10% of time writing actual code..
anyway - not really expecting a response on this but cool, if you know how to help..
You're not able to use node's fs because it is part of nodejs environment. As you surely know your application code is not running on nodejs but rather directly on your smartphone (besides debug mode but even there you cannot use node's fs package).
To access and manipulate smartphone's filesystem take a look at react-native-fs or rn-fetch-blob package.

Is ObjectPath.js necessary for Angular Schema Form to work?

I am trying to dynamically generate a form from JSON data. I found Angular Schema Form to handle this, but I couldn't get it to work. I kept getting this injection failed error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module MIS due to:
Error: [$injector:modulerr] Failed to instantiate module schemaForm due to:
TypeError: Cannot read property 'parse' of undefined
So I looked around for the answer, and found a working Plunk. As I was adapting it to better show my situation, I noticed that when I removed Object-path.js the plunk got my same error.
I went back the Angular Schema Form docs to see if I had missed it being required, but can't find any mention of it.
Is there something that would tell me about the required dependencies?
OR
Does ASF not require Object-Path, and I'm doing something else wrong?
Again, here's my plunk, if you comment out the Object-Path script you can see what I mean.
#travis-heeter you can find a list of dependencies in the package.json file. It lists "objectpath": "^1.2.1" as a dependency.
The readme file also includes an example header in the script loading section showing the script tags to include. This section should also be added to the docs for people who go to the docs directly.
In the alphas for version 1.0.0 the objectpath library is built into the JSON Schema Form Core library, removing it from the dependency list of Angular Schema Form itself.
Note: There are two libraries called ObjectPath the one you linked to is not the one included. The NPM entry is for objectpath while the one you linked to is object-path with a hyphen.

'Uncaught TypeError: angular.module(...).run(...) is not a function' in Grunt minified js-file

My code works on development mode, uncompressed. But when I use grunt's minify functionality and run the app in production mode, I get that error: Uncaught TypeError: angular.module(...).run(...) is not a function.
When I look into the error in Google Chrome Developer Tools, I get what you see in the screenshot. Does anybody understand where the problem is?
I am using Angular 1.4+ in Angular-Fullstack. The error occurs in vendor.{{randomstring}}.js.
Thanks for any support!
You have 2 issues here.
Dependency injection. You can edit manually the archives or use https://github.com/mgol/grunt-ng-annotate this will do this automagically for you.
Concatenation. Check this grunt plugin https://github.com/gruntjs/grunt-contrib-concat the issue here is javascript dont understand when a function end/start because dont have a separation mark, check where the error is.
})(function(a,b) {
It should be:
});(function(a,b) {
Check the "Concatenating with a custom separator" example of grunt-contrib-concat

camerapreview plugin is not found by my angular js app

So I have yet another problem with my home application. I am trying to get a live preview image directly on my html page. I am using VS Community and I linked to https://github.com/mbppower/CordovaCameraPreview.git to download the right repository. VS then tells me I have downloaded it. However, when I try to plug the line:
cordova.plugins.camerapreview.startCamera(rect, "front", tapEnabled, dragEnabled, toBack)
I get back an error in my javascript which reads as follows:
Cannot read property 'camerapreview' of undefined
I am following the orders of the github post to the letter but I am still getting an error. Any help in solving this problem will be greatly appreciated!
The error message
Cannot read property 'camerapreview' of undefined
tells you that in this statement:
cordova.plugins.camerapreview.startCamera(rect, ...
cordova.plugins is not defined - that's where you need to look.

Getting Angular Twitter API app working

I have been trying to get the following angular twitter API app to work out of the box but am running into an error on startup.
I am running node v0.10.36, npm 1.4.28
I just wanted to throw it out to the wider community to see if anyone could help me out.
I am trying to get the app working and am running into the error below. I tried a couple of things eg changing port, changing package.json to reflect a newer version of npm but I just don't seem to be able to get it to work. Any assistance would be appreciated. Thanks in advance.
It looks like all the node modules installed correctly.
/Users/billyjlennon/sample-angular-node/routes/tweets.js:36
var i = 0, len = tweets.length;
^
TypeError: Cannot read property 'length' of undefined
at /Users/billyjlennon/sample-angular-node/routes/tweets.js:36:28
at responseHandler (/Users/billyjlennon/sample-angular-node/node_modules/twit/lib/oarequest.js:362:14)
at passBackControl (/Users/billyjlennon/sample-angular-node/node_modules/twit/node_modules/oauth/lib/oauth.js:374:13)
at IncomingMessage.<anonymous> (/Users/billyjlennon/sample-angular-node/node_modules/twit/node_modules/oauth/lib/oauth.js:386:9)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
It would be such a handy app if I could get it to work!!!
Have you done this per the readme:
Create a config.js file using config.sample.js as a template. Fill in your Twitter App API Keys. You will need to create a Twitter application.
The fact that length is undefined indicates you aren't getting any data back.

Resources