diff --git a/src/app/components/noosfero-articles/article/article.directive.ts b/src/app/components/noosfero-articles/article/article.directive.ts
index 2f07c19..4331be5 100644
--- a/src/app/components/noosfero-articles/article/article.directive.ts
+++ b/src/app/components/noosfero-articles/article/article.directive.ts
@@ -1,42 +1,42 @@
import { bundle, Input, Inject, Component, Directive } from 'ng-forward';
+import {NoosferoArticleBlog} from "../blog/blog.component";
@Component({
selector: 'noosfero-default-article',
- templateUrl: 'app/components/noosfero-articles/article/article.html',
- providers: ['$injector', '$compile']
+ templateUrl: 'app/components/noosfero-articles/article/article.html'
})
export class ArticleView {
+
+ @Input() article: any;
+ @Input() profile: any;
+
constructor() {
console.log("ARTICLE VIEW");
}
}
-/**
-*
-*
-*
-*/
-
-@Directive({
- selector: '[noosfero-article]',
- providers: []
+@Component({
+ selector: 'noosfero-article',
+ template: '
',
+ directives: [ArticleView, NoosferoArticleBlog]
})
-@Inject("$element")
-@Inject("$scope")
-@Inject("$injector")
-@Inject("$compile")
+@Inject("$element", "$scope", "$injector", "$compile")
export class ArticleDirective {
- constructor($element: any, $scope: ng.IScope, private $injector: ng.auto.IInjectorService, private $compile: ng.ICompileService) {
- var specificDirective = 'noosfero' + $scope["vm"].article.type;
- if ($injector.has(specificDirective + 'Directive')) {
- var directiveName = specificDirective.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
- $element.replaceWith($compile('<' + directiveName + ' article="vm.article" profile="vm.profile">' + directiveName + '>')($scope));
- //$element.html($compile('<' + directiveName + ' article="vm.article" profile="vm.profile">' + directiveName + '>')(scope))
- } else {
- //TODO
+ @Input() article: any;
+ @Input() profile: any;
+ directiveName: string;
+
+ ngOnInit() {
+ let specificDirective = 'noosfero' + this.article.type;
+ this.directiveName = "noosfero-default-article";
+ if (this.$injector.has(specificDirective + 'Directive')) {
+ this.directiveName = specificDirective.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}
+ this.$element.replaceWith(this.$compile('<' + this.directiveName + ' [article]="ctrl.article" [profile]="ctrl.profile">' + this.directiveName + '>')(this.$scope));
}
-}
-//bundle('noosferoApp', ArticleDirective).publish();
+ constructor(private $element: any, private $scope: ng.IScope, private $injector: ng.auto.IInjectorService, private $compile: ng.ICompileService) {
+
+ }
+}
diff --git a/src/app/components/noosfero-articles/article/article.html b/src/app/components/noosfero-articles/article/article.html
index be3cbee..2019696 100644
--- a/src/app/components/noosfero-articles/article/article.html
+++ b/src/app/components/noosfero-articles/article/article.html
@@ -1,23 +1,23 @@
diff --git a/src/app/components/noosfero-articles/blog/blog.component.ts b/src/app/components/noosfero-articles/blog/blog.component.ts
index 51bfa35..53bf766 100644
--- a/src/app/components/noosfero-articles/blog/blog.component.ts
+++ b/src/app/components/noosfero-articles/blog/blog.component.ts
@@ -1,12 +1,13 @@
-import {Component, Input} from "ng-forward";
+import {Component, Input, Inject} from "ng-forward";
@Component({
selector: "noosfero-blog",
- templateUrl: "app/components/noosfero-articles/blog/blog.html",
- inputs: ["article", "profile"]
+ templateUrl: "app/components/noosfero-articles/blog/blog.html"
})
+@Inject("noosfero", "$scope")
export class NoosferoArticleBlog {
+
@Input() article;
@Input() profile;
@@ -14,12 +15,12 @@ export class NoosferoArticleBlog {
private perPage: number;
private currentPage: number;
private totalPosts: number = 0;
- constructor(private noosferoService: any) {
- this.loadPage();
+
+ constructor(private noosfero: any, private $scope) {
}
- loadPage() {
- this.noosferoService.articles.one(this.article.id).customGET("children", {
+ ngOnInit() {
+ this.noosfero.articles.one(this.article.id).customGET("children", {
content_type: "TinyMceArticle",
per_page: this.perPage,
page: this.currentPage
@@ -29,4 +30,4 @@ export class NoosferoArticleBlog {
});
}
-}
\ No newline at end of file
+}
diff --git a/src/app/components/noosfero-articles/blog/blog.html b/src/app/components/noosfero-articles/blog/blog.html
index e4941b2..758a3c9 100644
--- a/src/app/components/noosfero-articles/blog/blog.html
+++ b/src/app/components/noosfero-articles/blog/blog.html
@@ -1,24 +1,24 @@
-
-
![]()
-
+
+
![]()
+
-