Skip to content

Instantly share code, notes, and snippets.

View aaronfrost's full-sized avatar
:octocat:
Software Architect Contractor

Aaron Frost aaronfrost

:octocat:
Software Architect Contractor
View GitHub Profile
@aaronfrost
aaronfrost / service.js
Created September 30, 2015 17:38
caching service in Angular
angular.module('app').factory('myService', function($q, $http){
var data;
var dataPromise;
return {
getData: getData
}
function getData(){
//If the data is already here, return it in a resolved promise
@aaronfrost
aaronfrost / foo.js
Last active December 11, 2015 06:12
Show a defined property
var foo = {};
Object.defineProperty(a, "bar",{
get: getFoo,
set: setFoo
});
export default foo;
function getFoo(){
//do shiz
@aaronfrost
aaronfrost / myComponent.js
Last active April 29, 2017 19:01
templateUrl vs template
angular.module('app')
.component('myComponent', {
templateUrl: 'foo/bar/myComponent.html', // OLD WAY
controller: function(){
//controller code
}
});
angular.module('app')
@aaronfrost
aaronfrost / app.js
Created April 29, 2017 19:41
load template for ng-include
// ng-include templates
require('angulartemplate!./foo/bar/includedtemplate.html');
require('angulartemplate!./foo/bar/anotherincludedtemplate.html');
// and so on
@aaronfrost
aaronfrost / webpack.config.js
Created June 23, 2017 22:08
ngtools/webpack with Loader Support
const webpackconfig = {
module:{
rules: [
{
test: /\.ts$/,
use: [
{
loader: '@ngtools/webpack'
}
]
@aaronfrost
aaronfrost / sampleroute.ts
Created July 20, 2017 08:38
Sample Routes for Angular App
[
{
path: 'team/:id',
loadChildren: './team/team.module#TeamModule'
}
]
@aaronfrost
aaronfrost / question.ts
Created December 7, 2017 03:40
Firestore question
export class FooClass{
constructor(
private fb: FirebaseApp,
private fs: AngularFirestore,
){
const a = fb.firestore();
const b = this.fs;
// Are `a` and `b` pointing at the same thing?
}
// The values provided below are the defaults.
// If you don't specify one of these properties,
// the default value will be applied.
module.exports = {
printWidth: 80,
tabWidth: 2,
useTabs: true,
semi: true,
singleQuote: false,
trailingComma: 'none', // other options `es5` or `all`
package.json
@aaronfrost
aaronfrost / tslint.json.md
Last active February 22, 2018 17:46
Each of the following tslint rules will conflict with Prettier. You will want to remove them from your tslint.json if they exist.

Delete the following rules from your tslint.json to avoid conflict w/ Prettier

If any of them are missing, that is fine. Just move on.
- comment-format
- curly
- eofline
- import-spacing
- indent
- max-line-length
- no-trailing-whitespace