Skip to content

Instantly share code, notes, and snippets.

@craigcabrey
Created November 18, 2015 14:39
Show Gist options
  • Save craigcabrey/af2001c2b529685bd195 to your computer and use it in GitHub Desktop.
Save craigcabrey/af2001c2b529685bd195 to your computer and use it in GitHub Desktop.
angular-busy: 'this is undefined'
'use strict';
global.jQuery = require('jquery');
var angular = require('angular');
require('bootstrap');
require('angular-busy');
angular
.module('test', ['cgBusy'])
.controller('TestCtrl', ['$scope', '$q', function ($scope, $q) {
$scope.status = 'not resolved';
$scope.testPromise = $q(function(resolve, reject) {
setTimeout(function() {
resolve();
}, 2000);
}).then(function() {
$scope.status = 'resolved';
});
}]);
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
gulp.task('default', function () {
return browserify({
entries: 'app.js',
debug: true
})
.bundle()
.pipe(source('all.js'))
.pipe(gulp.dest('js'));
});
<!doctype html>
<html>
<head>
<title>Example</title>
<meta charset="utf-8">
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.css"/>
</head>
<body ng-app="test">
<div class="container" ng-controller="TestCtrl">
<div class="row" cg-busy="testPromise">
{{status}}
</div>
</div>
<script src="js/all.js"></script>
</body>
</html>
{
"name": "test",
"version": "1.0.0",
"description": "test",
"author": "",
"license": "ISC",
"dependencies": {
"angular": "^1.4.7",
"angular-busy": "^4.1.0",
"bootstrap": "^3.3.5",
"jquery": "^2.1.4"
},
"devDependencies": {
"browserify": "^12.0.1",
"browserify-shim": "^3.8.11",
"gulp": "^3.9.0",
"vinyl-source-stream": "^1.1.0"
},
"browser": {
"angular-busy": "./node_modules/angular-busy/dist/angular-busy.js"
},
"browserify-shim": {
},
"browserify": {
"transform": [
"browserify-shim"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment