This file contains 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
import 'dart:html'; | |
import 'package:angular/angular.dart'; | |
// Annotation which states that this class is a directive which should be | |
// attached to elements with a 'sample-text-id' attribute | |
@NgDirective(selector: '[sample-text-id]') | |
class ReverseClickDirective{ | |
// The element that the directive is attached to | |
Element element; |
This file contains 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
// Simple class holding some configuration | |
class ConfigService{ | |
String text; | |
ConfigService() { | |
this.text = "Meep!"; | |
} | |
} | |
@NgDirective(selector: '[sample-text-id]') | |
class ReverseClickDirective{ |
This file contains 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
/* | |
* @NgFilter(name: 'myfilter') | |
* function MyFilter() {} | |
*/ | |
function MyFilter() {} | |
MyFilter.annotations = [new NgFilter({name: 'myFilter'})]; |
This file contains 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
describe('click to reverse', function () { | |
var btn; | |
it('Reverses the button label on click', function () { | |
// load the page | |
browser.get('http://localhost:63342/protractorDemo/index.html'); | |
// Find the button | |
btn = element(by.binding('click.btnText')); |
This file contains 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
// ES6 Class | |
class MyClass { | |
constructor() { | |
this.a = "b"; | |
} | |
getA() { | |
return this.a; | |
} | |
} |
This file contains 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
// TypeScript types | |
function myFn(name:string, obj:MyClass) { | |
// ... | |
} | |
// Equivalent ES5 | |
/** | |
* @param name {string} | |
* @param obj {MyClass} | |
*/ |
This file contains 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
// AtScript types | |
function myFn(name:string, obj:MyClass) { | |
// ... | |
} | |
// Equivalent ES5 | |
/** | |
* @param name {string} | |
* @param obj {MyClass} | |
*/ |
This file contains 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
// Annotation in AtScript | |
@MyAnnotation({a: 'b'}) | |
function fn() {} | |
// Equivalent ES5 | |
function fn() {} | |
fn.annotations = [new MyAnnotation({a: 'b'})]; |
This file contains 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
angular.module('myApp', []).directive('myComponent', function() { | |
return { | |
scope: true, | |
controller: function() { | |
this.myProperty = 'myValue'; | |
this.myMethod = function() { | |
return 'myResult'; | |
}; | |
}, | |
controllerAs: 'myComponent' |
This file contains 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
// Configure module loader | |
System.config({ | |
baseURL: '/app/', | |
// Set paths for third-party libraries as modules | |
paths: { | |
'angular': 'bower_components/angular/angular.js', | |
'angular-route': 'bower_components/angular-route/angular-route.js' | |
} | |
}); |