From ba41cbc5d7c3211360359dcbcf51349e10ee37e3 Mon Sep 17 00:00:00 2001 From: Gregg Hernandez Date: Sat, 16 Jul 2016 12:04:55 -0600 Subject: [PATCH 1/4] Supprt styleUrls parameter of @Comonent --- src/main/scala/angulate2/Component.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/scala/angulate2/Component.scala b/src/main/scala/angulate2/Component.scala index 55f22d1..a26c9f1 100644 --- a/src/main/scala/angulate2/Component.scala +++ b/src/main/scala/angulate2/Component.scala @@ -22,7 +22,8 @@ class Component(selector: String = null, template: String = null, templateUrl: String = null, directives: js.Array[js.Any] = null, - styles: js.Array[String] = null) extends StaticAnnotation { + styles: js.Array[String] = null, + styleUrls: js.Array[String] = null) extends StaticAnnotation { def macroTransform(annottees: Any*): Any = macro Component.Macro.impl } @@ -42,7 +43,8 @@ object Component { "template", "templateUrl", "directives", - "styles") + "styles", + "styleUrls") def impl(annottees: c.Expr[Any]*) : c.Expr[Any] = annottees.map(_.tree).toList match { case (classDecl: ClassDef) :: Nil => modifiedDeclaration(classDecl) @@ -123,5 +125,3 @@ object Component { } } - - From e496035abbd0d3f6b302ade8d60eb79efc8184cc Mon Sep 17 00:00:00 2001 From: Gregg Hernandez Date: Sat, 16 Jul 2016 12:12:15 -0600 Subject: [PATCH 2/4] Adds redirectTo and pathMatch to RouteDefinition --- src/main/scala/angulate2/router/RouteDefinition.scala | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/scala/angulate2/router/RouteDefinition.scala b/src/main/scala/angulate2/router/RouteDefinition.scala index 1c4447c..6304875 100644 --- a/src/main/scala/angulate2/router/RouteDefinition.scala +++ b/src/main/scala/angulate2/router/RouteDefinition.scala @@ -22,6 +22,8 @@ object RDef { def apply(path: String = null, name: String = null, component: JSType = null, + redirectTo: js.UndefOr[String] = js.undefined, + pathMatch: js.UndefOr[String] = js.undefined, useAsDefault: Boolean = false) : RouteDefinition = { val d = js.Dynamic.literal() if(path!=null) @@ -30,6 +32,10 @@ object RDef { d.name = name if(component!=null) d.component = component + + redirectTo.foreach(d.redirectTo = _) + pathMatch.foreach(d.pathMatch = _) + d.useAsDefault = useAsDefault d.asInstanceOf[RouteDefinition] } From 976941d58affdc6df18719505c399b7c4ac17fd5 Mon Sep 17 00:00:00 2001 From: Gregg Hernandez Date: Sat, 16 Jul 2016 12:15:32 -0600 Subject: [PATCH 3/4] Adds newer RouterConfig --- src/main/scala/angulate2/router/RouterConfig.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/main/scala/angulate2/router/RouterConfig.scala diff --git a/src/main/scala/angulate2/router/RouterConfig.scala b/src/main/scala/angulate2/router/RouterConfig.scala new file mode 100644 index 0000000..e2f652f --- /dev/null +++ b/src/main/scala/angulate2/router/RouterConfig.scala @@ -0,0 +1,14 @@ +package angulate2.router + +import scala.scalajs.js +import scala.scalajs.js.annotation.JSName + +@js.native +@JSName("ng.router.RouterConfig") +trait RouterConfig extends js.Object + +object RouterConfig { + def apply(defs: RouteDefinition*): RouterConfig = { + js.Array(defs: _*).asInstanceOf[RouterConfig] + } +} \ No newline at end of file From 09f6f0b57f4345c2b380c98ec9e5b38e5db4afe4 Mon Sep 17 00:00:00 2001 From: Gregg Hernandez Date: Sun, 17 Jul 2016 22:08:52 -0600 Subject: [PATCH 4/4] Adds ActivatedRoute --- .../angulate2/router/ActivatedRoute.scala | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/scala/angulate2/router/ActivatedRoute.scala diff --git a/src/main/scala/angulate2/router/ActivatedRoute.scala b/src/main/scala/angulate2/router/ActivatedRoute.scala new file mode 100644 index 0000000..f8d54fd --- /dev/null +++ b/src/main/scala/angulate2/router/ActivatedRoute.scala @@ -0,0 +1,32 @@ +package angulate2.router + +import scala.scalajs.js +import scala.scalajs.js.| +import scala.scalajs.js.annotation.JSName +import rxjs.core.IObservable + +@js.native +@JSName("ng.router.ActivatedRoute") +trait ActivatedRoute extends js.Object { + val snapshot: ActivatedRouteSnapshot = js.native + val url: IObservable[UrlPathWithParams] = js.native + val params: IObservable[js.Dynamic] = js.native + val data: IObservable[js.Any] = js.native + val outlet: String = js.native + val component: js.Any = js.native +} + +@js.native +trait ActivatedRouteSnapshot extends js.Object { + val url: js.Array[UrlPathWithParams] = js.native + val params: js.Dynamic = js.native + val data: js.Any = js.native + val outlet: String = js.native + val component: js.Any = js.native +} + +@js.native +trait UrlPathWithParams extends js.Object { + val path: String = js.native + val parameters: Map[String, String] = js.native +} \ No newline at end of file