checkchanged event is not working with nstudio/nativescript-checkbox plugin - nativescript

I'm using the plugin tns plugin add #nstudio/nativescript-checkbox.
in document they had given clearly about checkedChange.
But i dont know why it is not working
https://play.nativescript.org/?template=play-js&id=utP80U
<CheckBox:CheckBox checked="{{ checkProp }}" text="{{ myCheckText }}"
fillColor="{{ myCheckColor }}" id="myCheckbox" checkedChange="{{ checkedChange }}" />
checkedChange : function () {
console.log("---checkedChange -----");
},
How to use checkedChange event

Since {N} 3.x property change events are not supported in XML, you must handle them in code behind file.
XML
<CheckBox:CheckBox checked="{{ checkProp }}" text="{{ myCheckText }}"
fillColor="{{ myCheckColor }}" id="myCheckbox" loaded="onCheckBoxLoaded" />
JS
function onCheckBoxLoaded(args) {
args.object.off("loaded");
args.object.on("checkedChange", homeViewModel.checkedChange);
}
Updated Playground

Related

Laravel Http Cache ESI tag Issue

I am using laravel-httpcache package in my laravel application.
my problem is whenever I use esi tag like this
<input type="hidden" name="_token" value="<esi:include src="{{ url('csrf') }}" />">
or like this
<esi:include src="{{ url('csrf_token') }}" />
it is giving me fatal error of
Maximum function nesting level of '256' reached, aborting!
any help please.
note: {{ url('csrf') }} only return csrf token from controller, and {{ url('csrf_token') }} return a csrf field with csrf_field() function
i am expecting the output like this
<input type="hidden" name="_token" value="1wcXG7boSmdwj2yszRwCjnYR0TEyHrwAFTYcLafe">
this is a dummy csrf token in value
Don't know this is a correct answer, but after googling I think that your problem may related with XDebug configs. If you working with XDebug, then you can folloe this:
Issue maybe caused by default xdebug.max_nesting_level which is 256 for you.
Try to change "max_nesting_level" in "php.ini" (in /etc/php/7.2/apache2 for my Ubuntu) to 512 for example. Like this:
xdebug.max_nesting_level = 512
Also don't forget to restart your Server.

What are Parse Html token methods for email templates in golang?

I am trying to create email templates having html tokens in golang. I have searched all over the web and found
"html/template"
library. It supports token format like below
Hello {{.Name}}
Confirm email address
But the requirement for html token is something like
Name: {{ test.name }}
Phone: {{ test.phone }}
Address: {{ test.address }}, {{ test.city }}, {{ test.state }} {{ test.zip }}
I could not found such token system in golang or any library supporting such format. Can anyone please tell how can I achieve to create such tokens. There should be no dot before the attribue. either it should be only the attribute like {{Name}} or like {{ test.name }}.
Thank you!
If you can use a $ before attribute names, you can use the template's [with][1] action. Something like:
tmpl :=`
{{ with $test := . }}
Name: {{ $test.Name }}
Phone: {{ $test.Phone }}
Address: {{ $test.Address }}, {{ $test.City }}, {{ $test.State }} {{ $test.Zip }}
{{ end }}
`
Note that each struct field needs to be exported.

Nativescript ListView onItemLoading event

I'm using the built-in ListView and have the following setup.
<ListView items="{{ myItems }}" itemLoading="onItemLoading" itemTemplateSelector="onTemplateSelector">
<ListView.itemTemplates>
<template key="even">
<Label text="{{ age }}" style.backgroundColor="white" />
</template>
<template key="odd">
<Label text="{{ age }}" style.backgroundColor="gray" />
</template>
</ListView.itemTemplates>
During the onLoadingEvent - where each item is about to be loaded, I look at the args.view and it's always undefined. I would have expected it to be the full template view structure - depending on what onTemplateSelector returned.
Looking at some more of the documentation and it seems that if it's undefined then you've got to create the entire structure within code.
Did I miss something? If no, then what's the purpose of allowing the template item definitions (e.g. Label in my sample code).
If you just do
<ListView.itemTemplates>
<Label text="{{ age }}" style.backgroundColor="gray" />
</ListView.itemTemplates>
That will work fine. I'm not sure what your <template> element is.

Old input for array?

I have foreach and inside foreach i have input like this:
<input type="text" id="text-title" name="article_title[{{$language->code}}]" value="{{ old('article_title[$language->code]') }}" class="form_input" />
Im trying to add old input like this but its not working. Any suggestion how can i use old for array?
Also i tried this but also not working:
<input type="text" id="text-title" name="article_title[{{$language->code}}]" value="{{ old('article_title.0') }}" class="form_input" />
I have validation only for first iteration if that means anything for you.
You should be able to access the index off of your language code:
value="{{ old('article_title.'.$language_code) }}"
you can use the old to return old value as an array
# old('article_title') => array
value="{{ old('article_title')[$language_code] ?? "" }}"

how to retrieve image from database in laravel 5.1?

I have image name in the database and image upload in public/image folder.
Now I want to show the image on the web page.
How do I do this?
I am using
<img src="{{ URL::to('/') }}/images/{{ $item->Photo }}" alt="{{ $item->Title }}"/>
You can use the asset() helper function, like so:
<img src="{{ asset("images/$item->Photo") }}" alt="{{ $item->Title }}" >
You could use <img src="{{ asset('/image') }}" />
Easiest way would be to add a method to your user model.
That method will return the url of your image, you will name that method getImageUrl() for example.
your function :
public function getImageUrl(){
return asset($this->image);
}
That way you just have to do something like this in your view
<img src="{{ $user->getImageUrl() }}" />
Then if at some point you change the storage location of your pictures you just have to change it in the getImageUrl function.
{{HTML::image("images/$item->YourDBFieldNameOfImageURL", "ALT description", "");}}

Resources