npm install
npm run build
open index.html-
-
Save bdylanwalker/bd4b1e88f5d9d623189a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node_modules/ | |
| npm-debug.log | |
| bundle.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var angular = require('angular'); | |
| var app = angular.module('app', [ | |
| require('angular-local-storage'), | |
| ]); | |
| app.run(function(localStorageService) { | |
| if (!localStorageService.get('lastVisit')) { | |
| angular.element('body').text('Hello stranger!'); | |
| } else { | |
| angular.element('body').text('Welcome back!'); | |
| } | |
| localStorageService.set('lastVisit', Date.now()); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="bundle.js"></script> | |
| </head> | |
| <body ng-app="app"> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "private": true, | |
| "homepage": "http://aymericbeaumet.me/properly-shim-angularjs-applications-using-browserify/", | |
| "author": "Aymeric Beaumet", | |
| "license": "UNLICENSE", | |
| "scripts": { | |
| "build": "browserify app.js -o bundle.js" | |
| }, | |
| "dependencies": { | |
| "angular": "1.3.14", | |
| "angular-local-storage": "0.1.5", | |
| "jquery": "2.1.3" | |
| }, | |
| "browser": { | |
| "angular": "./node_modules/angular/angular.js", | |
| "angular-local-storage": "./node_modules/angular-local-storage/dist/angular-local-storage.js" | |
| }, | |
| "browserify-shim": { | |
| "angular": { | |
| "depends": "jquery:jQuery", | |
| "exports": "angular" | |
| }, | |
| "angular-local-storage": { | |
| "depends": "angular", | |
| "exports": "angular.module('LocalStorageModule').name" | |
| } | |
| }, | |
| "browserify": { | |
| "transform": [ | |
| "browserify-shim" | |
| ] | |
| }, | |
| "devDependencies": { | |
| "browserify": "9.0.3", | |
| "browserify-shim": "3.8.3" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment