Skip to content

Instantly share code, notes, and snippets.

@tuchk4
Created December 1, 2015 09:04
Show Gist options
  • Save tuchk4/6c25e0fc25cb5eb5d31d to your computer and use it in GitHub Desktop.
Save tuchk4/6c25e0fc25cb5eb5d31d to your computer and use it in GitHub Desktop.
Directive - Valentjs vs AngularJS
angular.module('example').directive('helloWorld', function() {
return {
restrict: 'E',
template: '<div> {{ name }} </div>',
link: function(scope, element) {
// scope.name = 1;
element.addClass('orange')l
},
controller: ['$scope', funtion($scope) {
$scope.name = 1;
}]
}
});
class HelloWorldController {
name = 1;
constructor() {
}
link(element) {
element.addClass('orange');
}
static render() {
return '<div> {{ name }} </div>';
}
}
valent.component('hello-world', HelloWorldController);
class HelloWorldController {
name = 1;
constructor() {
}
link(element) {
element.addClass('orange');
}
}
valent.component('hello-world', HelloWorldController, {
template: '<div> {{ name }} </div>',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment