From eb4a02cc2228e5e127f031b4776bc2c2b0ffed49 Mon Sep 17 00:00:00 2001 From: Youcef Mammar Date: Wed, 21 May 2014 15:44:56 +0200 Subject: [PATCH] added a remark related to https://github.com/tkrugg/angular-delite/issues/1 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 9823ede..529f5de 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ define([ ``` + ### Initialize the widget While attributes can perfectly initialize your widget, you may want do this when your widget instance is created, for some specific widgets that require it. @@ -110,12 +111,14 @@ This will produce the following scope #### Accessing the entire widget instance from parent scope The deliteful widget can be accessed in the parent scope when an `id` attribute is added in the directive. + ```html
This guys name is {{myWidget.name}}
``` + ```js function ParentCtrl($scope){ $scope.rename = function(){ @@ -123,9 +126,13 @@ function ParentCtrl($scope){ } } ``` + You can also use `data-id` or `x-id` instead, as `id` must be unique to an entire page, wherease our variable is unique to the parent scope only. +NB: you can't use this to initialize you widget from the controller, cf. https://github.com/tkrugg/angular-delite/issues/1 +Instead use [this](#init). + ### Store Any store instance can be wrapped a regular angular module with `ngStore`