Skip to content

Instantly share code, notes, and snippets.

View oliverm2112's full-sized avatar

Oliver Merk oliverm2112

View GitHub Profile
@oliverm2112
oliverm2112 / ListCtrl.js
Last active December 16, 2015 09:39
In the controller
$scope.$emit('post.test', {method : 'getUser', userid:'myid', password:'mypw'}); // cache:false
$scope.$on('post.success', function () {
console.log('POST OK.');
});
$scope.$on('post.error', function () {
console.log('POST fail server!');
});
app.factory('httpService', ['$http', '$rootScope', function ($http, $rootScope) {
var service = {},
name;
const GATEWAY = 'http://localhost:3000/';
const CFGATEWAY = 'http://localhost:8501/angular/gateway.cfm';
$rootScope.$on('post.test', function (event, data) {
name = event.name;
app.run(['$injector', function ($injector) {
$injector.get('httpService');
}]);
app.factory('httpServiceInterceptor', ['$q', function ($q) {
return function (promise) {
return promise.then(function (response) {
return response;
}, function (response) {
return $q.reject(response);
}
);
};
}]);
$httpProvider.responseInterceptors.push('httpServiceInterceptor');
basePath = '';
files = [
JASMINE,
JASMINE_ADAPTER,
// 3rd-party
'app/scripts/vendor/angular.js',
// App-specific
app.directive('focus', function () {
return {
restrict: 'A',
link : function (scope, element) {
element[0].focus();
}
}
});
@oliverm2112
oliverm2112 / links.txt
Last active December 16, 2015 02:38
Learning AngularJS
@oliverm2112
oliverm2112 / simple.html
Created April 11, 2013 13:48
My First App
<!DOCTYPE html>
<html ng-app>
<head>
<title>My First Angular Application</title>
</head>
<body>
<input type="text" ng-model="inputVal" placeholder="Please enter your name" value=""/>
<br>
<span ng-show="inputVal.length > 0">Hello</span> {{inputVal}}
@oliverm2112
oliverm2112 / LoginCtrl.js
Last active December 16, 2015 02:38
Angular - Login Controller sample
app.controller('LoginCtrl', ['$scope', function ($scope) {
$scope.model = {
userName : '',
password : 'name'
};
}]);