javascript on davidchua https://dchua.com/tags/javascript/ Recent content in javascript on davidchua Hugo -- gohugo.io en-us Sun, 07 Feb 2016 00:00:00 +0000 Getting npm packages to be installed with docker-compose https://dchua.com/posts/2016-02-07-getting-npm-packages-to-be-installed-with-docker-compose/ Sun, 07 Feb 2016 00:00:00 +0000 https://dchua.com/posts/2016-02-07-getting-npm-packages-to-be-installed-with-docker-compose/ If you’re trying to deploy your node app into a docker container and you’re also using docker-compose, here’s something to watch out for. If you are running npm install on your Dockerfile, you might want to make sure that you mount /node_modules as a data volume in your docker-compose. For eg. your Dockerfile might look something like this: # Dockerfile FROM node:5.5.0 ADD ./ /node_app WORKDIR /node_app RUN npm install Normal stuff. How to add a confirmation dialog box in AngularJS https://dchua.com/posts/2014-11-19-how-to-add-a-confirmation-dialog-box-in-angularjs/ Wed, 19 Nov 2014 00:00:00 +0000 https://dchua.com/posts/2014-11-19-how-to-add-a-confirmation-dialog-box-in-angularjs/ Setting up a confirmation box can be quite tricky, here’s how to quickly get a confirmation box setup in AngularJS. Pre-requisite AngularJS is already loaded and running You are using real jQuery instead of jqLite (I’ll explain below) Prepare your HTML First, start off with a blank HTML page. Create a link that you would like to run a function() on when clicked and confirmed. It should look something like this: Fix AngularJS from loading twice error on Rails 4 https://dchua.com/posts/2014-11-16-fix-angularjs-from-loading-twice-error-on-rails-4/ Sun, 16 Nov 2014 00:00:00 +0000 https://dchua.com/posts/2014-11-16-fix-angularjs-from-loading-twice-error-on-rails-4/ If you’re running a Rails 4.x app with AngularJS, and you’re getting increasingly frustrated with receiving “AngularJS loaded twice” errors and you can’t seem to figure out what went wrong, perhaps you might want to make sure you do two things first: First, remove Turbolinks Gem Remove require ‘turbolinks’ from your application.js It is not apparent at first but turbolinks inject its own form of javascript into your views and when run, it will actually overwrite your normal angular behavior.