Micro blog about Answer to the Ultimate Question of Life, the Universe, and Everything
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home
  3. JavaScript
  4. Knockout

Closing tags

Details
Written by: Stanko Milosev
Category: Knockout
Published: 01 October 2013
Last Updated: 01 October 2013
Hits: 3882

It seems that knockout doesn't like HTML without closing tags. Code like:

<div data-bind="foreach: Cars">

	<!-- car value has to exist and has to be under quotes, otherwise it doesn't work -->
	<select autowidth="true" data-bind="
		options: $root.carTypes
		,optionsValue: 'carValue'
	"/>
	<br>test</br>

</div>

Will produce something like (notice that "test" is inside select tag):

<select autowidth="true" data-bind="
				options: $root.carTypes
				,optionsValue: 'carValue'
			"><option value="BMW">BMW</option><option value="Ferrari">Ferrari</option><option value="Fiat">Fiat</option><option value="Ford">Ford</option><option value="Mercedes-Benz">Mercedes-Benz</option>
			test

		

	

</select>

Code like:

<div data-bind="foreach: Cars">

	<!-- car value has to exist and has to be under quotes, otherwise it doesn't work -->
	<select autowidth="true" data-bind="
		options: $root.carTypes
		,optionsValue: 'carValue'
	"></select>
	<br></br>

</div>

Will produce something like:

<div data-bind="foreach: Cars">

	<!-- car value has to exist and has to be under quotes, otherwise it doesn't work -->
	<select autowidth="true" data-bind="
		options: $root.carTypes
		,optionsValue: 'carValue'
	"><option value="BMW">BMW</option><option value="Ferrari">Ferrari</option><option value="Fiat">Fiat</option><option value="Ford">Ford</option><option value="Mercedes-Benz">Mercedes-Benz</option></select>
	<br><br>

</div>

Notice <br> tag two times

 

Finally code (notice that br is without closing tag):

<div data-bind="foreach: Cars">

	<!-- car value has to exist and has to be under quotes, otherwise it doesn't work -->
	<select autowidth="true" data-bind="
		options: $root.carTypes
		,optionsValue: 'carValue'
	"></select>
	<br/>

</div>

Will work as expected

self = this

Details
Written by: Stanko Milosev
Category: Knockout
Published: 01 October 2013
Last Updated: 30 November -0001
Hits: 4208

Because this can be something else, read here.

Autocomplete

Details
Written by: Stanko Milosev
Category: Knockout
Published: 30 September 2013
Last Updated: 30 September 2013
Hits: 4179

Example is taken from here. And my example you can see here. As usual my example is ugly :), without CSS but idea is just to see an example.

Change the value of drop down list

Details
Written by: Stanko Milosev
Category: Knockout
Published: 06 September 2013
Last Updated: 06 September 2013
Hits: 3609

Example you can see here. My problem was in this line:

a.notificationRules()[0].notificationRule("Position")

  1. Few examples

Page 5 of 6

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6