Index: src/site/docs/tutorials/forms/examples/slambook/out/web/tute_slambookform.dart |
diff --git a/src/site/docs/tutorials/forms/examples/slambook/out/web/xslambookform.dart b/src/site/docs/tutorials/forms/examples/slambook/out/web/tute_slambookform.dart |
similarity index 55% |
rename from src/site/docs/tutorials/forms/examples/slambook/out/web/xslambookform.dart |
rename to src/site/docs/tutorials/forms/examples/slambook/out/web/tute_slambookform.dart |
index 2bb91308ae360852c6c0ffa582bc793172188932..a8e7a6a03ff40deaf9277335419c55f1cccb6bdc 100644 |
--- a/src/site/docs/tutorials/forms/examples/slambook/out/web/xslambookform.dart |
+++ b/src/site/docs/tutorials/forms/examples/slambook/out/web/tute_slambookform.dart |
@@ -1,52 +1,32 @@ |
import 'dart:html'; |
-import 'dart:json' as json; |
+import 'dart:convert'; |
import 'package:polymer/polymer.dart'; |
-@CustomTag('x-slambook-form') |
-class SlamBookComponent extends PolymerElement with ChangeNotifierMixin { |
- |
- String __$firstName = "mem"; |
- String get firstName => __$firstName; |
- set firstName(String value) { |
- __$firstName = notifyPropertyChange(const Symbol('firstName'), __$firstName, value); |
- } |
+@CustomTag('tute-slambook-form') |
+class TuteSlamBookForm extends PolymerElement { |
+ @observable String get firstName => __$firstName; String __$firstName = "mem"; set firstName(String value) { __$firstName = notifyPropertyChange(#firstName, __$firstName, value); } |
// Set up the maps for the form and give initial values. |
// Boolean values in this map are bound with bind-checked to checkboxes. |
- Map<String, bool> __$favoriteThings = toObservable({ |
- 'kittens': true, 'raindrops': false, |
- 'mittens': true, 'kettles': false}); |
- Map<String, bool> get favoriteThings => __$favoriteThings; |
- set favoriteThings(Map<String, bool> value) { |
- __$favoriteThings = notifyPropertyChange(const Symbol('favoriteThings'), __$favoriteThings, value); |
- } |
- |
+ @observable Map<String, bool> get favoriteThings => __$favoriteThings; Map<String, bool> __$favoriteThings = toObservable({ |
+ 'kittens': true, 'raindrops': false, |
+ 'mittens': true, 'kettles': false}); set favoriteThings(Map<String, bool> value) { __$favoriteThings = notifyPropertyChange(#favoriteThings, __$favoriteThings, value); } |
// This map contains the rest of the forma data. |
- Map __$theData = toObservable({ |
- 'firstName': 'mem', |
- 'favoriteQuote': 'Enjoy all your meals.', |
- 'favoriteColor': '#4169E1', |
- 'birthday': '1963-08-30', |
- 'volume': '11', //I want this to be bound to an integer! |
- 'catOrDog': 'dog', |
- 'music': 2, |
- 'zombies': true |
- // Add favoriteThings later...can't do it here...there is no this. |
- }); |
- Map get theData => __$theData; |
- set theData(Map value) { |
- __$theData = notifyPropertyChange(const Symbol('theData'), __$theData, value); |
- } |
- |
+ @observable Map get theData => __$theData; Map __$theData = toObservable({ |
+ 'firstName': 'mem', |
+ 'favoriteQuote': 'Enjoy all your meals.', |
+ 'favoriteColor': '#4169E1', |
+ 'birthday': '1963-08-30', |
+ 'volume': '11', //I want this to be bound to an integer! |
+ 'catOrDog': 'dog', |
+ 'music': 2, |
+ 'zombies': true |
+ // Add favoriteThings later...can't do it here...there is no this. |
+ }); set theData(Map value) { __$theData = notifyPropertyChange(#theData, __$theData, value); } |
- String __$serverResponse = ''; |
- String get serverResponse => __$serverResponse; |
- set serverResponse(String value) { |
- __$serverResponse = notifyPropertyChange(const Symbol('serverResponse'), __$serverResponse, value); |
- } |
- |
+ @observable String get serverResponse => __$serverResponse; String __$serverResponse = ''; set serverResponse(String value) { __$serverResponse = notifyPropertyChange(#serverResponse, __$serverResponse, value); } |
HttpRequest request; |
void submitForm(Event e, var detail, Node target) { |
@@ -95,12 +75,12 @@ class SlamBookComponent extends PolymerElement with ChangeNotifierMixin { |
theData['catOrDog'] = 'cat'; |
theData['music'] = 0; |
theData['zombies'] = false; |
- serverResponse = 'Data cleared.'; |
+ serverResponse = 'Data reset.'; |
} |
String _slambookAsJsonData() { |
// Put favoriteThings in the map. |
theData['favoriteThings'] = favoriteThings; |
- return json.stringify(theData); |
+ return JSON.encode(theData); |
} |
} |