I recently went this course in TextModel. By default, the text property was 
undefined which propagated to the view when it was never set. I changed it to 
'private var _text:String = “”;' to set the default to an empty string.

Harbs

> On Feb 16, 2017, at 8:58 PM, Carlos Rovira <carlos.rov...@codeoscopic.com> 
> wrote:
> 
> Hi, I was thinking the same as Om. Only setting a default would to the trick
> 
> thanks
> 
> 2017-02-16 19:56 GMT+01:00 OmPrakash Muppirala <bigosma...@gmail.com>:
> 
>> On Thu, Feb 16, 2017 at 10:51 AM, Alex Harui <aha...@adobe.com> wrote:
>> 
>>> 
>>> 
>>> On 2/16/17, 10:37 AM, "carlos.rov...@gmail.com on behalf of Carlos
>> Rovira"
>>> <carlos.rov...@gmail.com on behalf of carlos.rov...@codeoscopic.com>
>>> wrote:
>>> 
>>>> Hi Alex,
>>>> 
>>>> IMHO, this is not PAYG, no body wants "undefined" as a possible output.
>>>> In my way of thinking this could be very radical way and take PAYG to
>> the
>>>> latest extreme.
>>>> In that way almost all things are PAYG and should not be implemented in
>>>> basic set ;) ... what do you think?
>>> 
>>> You are welcome to build in a test for null and undefined in your
>>> component sets.  The way I think of it is: in production, how often is
>>> null or undefined going to be assigned to a label?  I would think it
>> would
>>> be very rare, if at all, but I could be wrong.  If you use Model/View,
>>> have the model and its validators prevent null/undefined from being a
>>> value that the view is bound to.
>>> 
>> 
>> I don't think a test for null or undefined is required.  That implies code
>> running needlessly.
>> I am guessing that having a sensible default would solve this problem.
>> That does not run code needlessly.
>> 
>> Thanks,
>> Om
>> 
>> 
>>> 
>>> My 2 cents,
>>> -Alex
>>> 
>>>> 
>>>> 2017-02-16 2:55 GMT+01:00 Alex Harui <aha...@adobe.com>:
>>>> 
>>>>> The Basic components don't test for unexpected inputs.  It isn't PAYG.
>>>>> We
>>>>> should try to remember to add some defensive code for common cases to
>>>>> Express.
>>>>> 
>>>>> -Alex
>>>>> 
>>>>> On 2/15/17, 3:31 PM, "Justin Mclean" <jus...@classsoftware.com>
>> wrote:
>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> This application when run displays “undefined” in text on the screen.
>>>>>> 
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <js:Application xmlns:fx="http://ns.adobe.com/mxml/2009";
>>>>>>               xmlns:js="library://ns.apache.org/flexjs/basic"
>>>>>>               xmlns:local="*">
>>>>>> 
>>>>>>   <js:valuesImpl>
>>>>>>       <js:SimpleCSSValuesImpl/>
>>>>>>   </js:valuesImpl>
>>>>>> 
>>>>>>   <js:initialView>
>>>>>>       <js:View percentWidth="100" percentHeight="100">
>>>>>>           <js:VContainer>
>>>>>>               <js:Label text="Here is some text" />
>>>>>>               <local:SimpleComponent />
>>>>>>           </js:VContainer>
>>>>>>       </js:View>
>>>>>>   </js:initialView>
>>>>>> 
>>>>>> </js:Application>
>>>>>> 
>>>>>> The component code:
>>>>>> 
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <js:VContainer xmlns:fx="http://ns.adobe.com/mxml/2009";
>>>>>>               xmlns:js="library://ns.apache.org/flexjs/basic">
>>>>>> 
>>>>>>   <fx:Script><![CDATA[
>>>>>>               [Bindable] public var text:String;
>>>>>>       ]]></fx:Script>
>>>>>> 
>>>>>>   <js:beads>
>>>>>>       <js:ContainerDataBinding />
>>>>>>   </js:beads>
>>>>>> 
>>>>>>   <js:Label text="{text}" />
>>>>>> 
>>>>>> </js:VContainer>
>>>>>> 
>>>>>> This can be worked around by doing this in the component:
>>>>>> 
>>>>>>   <fx:Script><![CDATA[
>>>>>>               [Bindable] public var text:String = “";
>>>>>>       ]]></fx:Script>
>>>>>> 
>>>>>> But still looks like a bug / is unexpected behaviour to me. What do
>>>>> other
>>>>>> people think?
>>>>>> 
>>>>>> Thanks,
>>>>>> Justin
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> --
>>>> 
>>>> Carlos Rovira
>>>> Director General
>>>> M: +34 607 22 60 05
>>>> http://www.codeoscopic.com
>>>> http://www.avant2.es
>>>> 
>>>> Este mensaje se dirige exclusivamente a su destinatario y puede contener
>>>> información privilegiada o confidencial. Si ha recibido este mensaje por
>>>> error, le rogamos que nos lo comunique inmediatamente por esta misma
>> vía y
>>>> proceda a su destrucción.
>>>> 
>>>> De la vigente Ley Orgánica de Protección de Datos (15/1999), le
>>>> comunicamos
>>>> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
>>>> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
>>>> servicio o información solicitados, teniendo usted derecho de acceso,
>>>> rectificación, cancelación y oposición de sus datos dirigiéndose a
>>>> nuestras
>>>> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
>>>> necesaria.
>>> 
>>> 
>> 
> 
> 
> 
> -- 
> 
> Carlos Rovira
> Director General
> M: +34 607 22 60 05
> http://www.codeoscopic.com
> http://www.avant2.es
> 
> Este mensaje se dirige exclusivamente a su destinatario y puede contener
> información privilegiada o confidencial. Si ha recibido este mensaje por
> error, le rogamos que nos lo comunique inmediatamente por esta misma vía y
> proceda a su destrucción.
> 
> De la vigente Ley Orgánica de Protección de Datos (15/1999), le comunicamos
> que sus datos forman parte de un fichero cuyo responsable es CODEOSCOPIC
> S.A. La finalidad de dicho tratamiento es facilitar la prestación del
> servicio o información solicitados, teniendo usted derecho de acceso,
> rectificación, cancelación y oposición de sus datos dirigiéndose a nuestras
> oficinas c/ Paseo de la Habana 9-11, 28036, Madrid con la documentación
> necesaria.

Reply via email to