Created
April 5, 2016 18:30
-
-
Save hakant/69363eaf32e2052d2d2697335704555e to your computer and use it in GitHub Desktop.
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 {computedFrom} from 'aurelia-framework'; | |
import {Container} from 'aurelia-dependency-injection'; | |
import {ensure} from 'aurelia-validation'; | |
import {Validation} from 'aurelia-validation'; | |
export class Project { | |
@ensure(function(it) { it.isNotEmpty().hasLengthBetween(3, 100) }) | |
_title = null; | |
@ensure(function(it) { it.isNotEmpty().hasLengthBetween(5, 300) }) | |
_overview = null; | |
constructor(data) { | |
this._id = data.id; | |
this._user = data.user; | |
this._title = data.title; | |
this._overview = data.overview; | |
let validation = Container.instance.get(Validation); | |
this.validation = validation.on(this); | |
this._data = data; | |
} | |
@computedFrom('_likeCount') | |
get likeCount() { | |
return this._likeCount; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment