Skip to content

Instantly share code, notes, and snippets.

import {Injectable} from 'angular2/core';
import {Tab} from './tab';
@Injectable()
export class TabService {
private static _tabs: Tab[] = [new Tab(1, "Dog Dingo", "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut."),
new Tab(2, "Horse Harry", "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.")];
getTabs(): Promise<Array<Tab>> {
@jepetko
jepetko / tab.model.ts
Created March 21, 2016 19:16
Tab model
export class Tab {
private _active: boolean;
constructor(private _id: number = -1, public title?: String, public content?: String) {
}
set active(active: boolean) {
this._active = active;
}
@jepetko
jepetko / angular-typescript-providers.ts
Created February 20, 2016 22:48
demonstrates how to define angularjs providers in Typescript
//Example 1: inline definition... not configurable :-(
angular.module("myApp", [])
.provider("Dummy", <ng.IServiceProvider>{
'$get': function() {
return { value: 1 };
}
})
.config(["DummyProvider", function(Dummy: ng.IServiceProvider) {
#weather {
font-size: 20px;
font-weight: bold;
border: 2px solid black;
padding: 20px;
}
.rainy {
@jepetko
jepetko / jsbin.iMERiFo.css
Created September 13, 2013 15:14
auto-mapping arguments similar to AngularJS
.arg {
border: 1px solid blue;
background: lightgrey;
margin: 5px;
}
pre {
border: 1px dotted blue;
background: lightgrey;
padding: 5px;
@jepetko
jepetko / jsbin.iMERiFo.css
Created September 13, 2013 14:42
This code simulates AngularJS auto mapping of arguments.
.arg {
border: 1px solid blue;
background: lightgrey;
margin: 5px;
}
pre {
border: 1px dotted blue;
background: lightgrey;
padding: 5px;