how can i add filesaver.js to gulp - angularjs

I am trying to manage my app which is a spa angular using gulp. Now i have a problem with FileSaver . My app requires me to download some files.
I use the following code for the same
$window.saveAs(response.response,downloadFile);
When I check the response i am getting the file in blob form. But the debugger doesnt go past save as function. I think FileSaver.js file is not getting recognised. I have added both blob.js and fileSaver.js in the vendor.js n I can see them too. But only blob.js works . I am using this http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js
What should i do?

Related

React.js files are minified and I cant make frontend changes

I have got web app which is built using laravel and react.js ; I need to change something in frontend but found that all react files are minified in app.js file, so changing frontend files does not have any effect. I don't have experience in react. Can you please suggest how to regenerate update minified app.js file?
thanks a lot!
I have tried changing frontend js files like normal but it was not working.

Unable to execute JS call: __fbBatchedBridge is undefined

I get this error only, when I use bundled js.Before bundled app works properly ,used react native version is 0.19.How to remove this error while bundled please help me
The screen shot is attached below
Ensure that your AppDelegate.m file is not registering the React URL as pointing to disk. In 0.19, no on-disk bundle is created when deploying to the simulator. It must fetch the bundle over localhost or another IP.

Unable to load Utility File

I am trying to load a utility file called as apiclient which is present in
app/stores/util
My distribution folder has a file cfile.js which is calling this file using the following code :
var api = require('../util/apiclient');
I am able to load the component files etc which are present in the app/components folder via a similar code and they work without any issue. But when i try to load the API client i just keep getting this error.
Uncaught Error: Cannot find module '../util/apiclient'
This is how my files and directories are present http://prntscr.com/7qkovs
Could someone help me out over here ?
Thanks
Well your structure is like this:
clinical-notes
app
stores
util
apiclient.js
dist
cfile.js
So when going from cfile.js to apiclient.js the correct require path would be ../app/stores/util/apiclient.js.
But this is neither a reactjs nor flux problem ;)

How can I restrict access to a directory inside web root?

I have an angular app and I concatenate and minify all of the angular.js files so it is more difficult for a user to "borrow" my code. I want to restrict access to my angular directory, which is inside the web root. I tried the following, but it doesn't work:
app.get('/angular/', function(req, res) {
res.redirect('/');
});
The problem is that anyone can enter mydomain.com/angular/controllers.js, for example, and see the controllers.js file. I am a bit surprised since I thought that I specified in the routes to redirect the user when attempting to access any file inside the angular directory. What am I doing wrong?
A user can just open the web inspector for their browser and read your code once it's running in their browser so doing this won't solve your problem.
You should instead minify and uglify the code into a single bundle perhaps? I do this using browserify as you can see in this project https://github.com/evanshortiss/cordova-angular-browserify. Then you can just run the code that has been bundled through uglify.
If you don't want to use browserify you could just find another way such as reading the JS files in your html file, then read them all and dump them into a single .js file in the correct order.
As there are beautify solutions, Minify or uglify can't be good solutions!
You can move your private files/folders into directories which are not http accessible.
Hope this helps! :)

Integrating youtube-direct-lite with angularjs app

I was unable to find any open source video recorder that can be integrated with an angularjs app. I came across Youtube-direct-lite but I have no idea how to integrate this with an angular app. I am trying to host my own instance of youtube-direct-lite
I have already configured the config.js as been told in this doc. Should I just copy paste all the js, css files to my project and use the index.html as a partial to display the recorder?
about configuring direct lite:
in config.js enter your developer-key and client-id.
then read the README file
download nodejs console
browse to the folder with the source in it
run this command : node r.js -o app.build.js
and it'll build the minified source for you, then copy and paste that source into your website and use the index.html & admin.html as the
and i'll work just fine.
about angular with direct lite:
I've seen so far only one implementation for it that is in youtube/dev/demos
http://www.youtube.com/yt/dev/demos.html#/upload
if you opened the sources, you'll find that it is uses angular, and it applies ytdirectlite, but I don't know how to use it and I still cannot find the opensource for it.

Resources