Angular JS – Custom Built Editor Template ASP.NET MVC

Untuk dapat menggunakan custom built editor template, pastikan terlebih dahulu terdapat file-file berikut.

  1. ~/Infrastructure/Abstract/IObjectExtender.cs
  2. ~/Infrastructure/Concrete/ObjectExtender.cs
  3. ~/Extension/HtmlExtensions.cs

Untuk cara penggunaan sendiri:

Textbox

[code lang=”html”]
@Html.AngularEditorFor(<expression>, <ngModel>, <htmlAttributes | optional>)
[/code]

Example:
[code lang=”html”]
@Html.AngularEditorFor(model => model.Test, "val.test", new { @class = "" })
[/code]
 

Numeric Textbox

[code lang=”html”]
@Html.AngularEditorFor(<expression>, <ngModel>, <htmlAttributes | optional>)
[/code]

Example:
[code lang=”html”]
@Html.AngularEditorFor(model => model.TestNumber, "val.test_number", new { @class = "" })
[/code]
 

Datepicker

[code lang=”html”]
@Html.AngularEditorFor(<expression>, <ngModel>, <htmlAttributes | optional>)
[/code]

Example:
[code lang=”html”]
@Html.AngularEditorFor(model => model.TestDate, "val.test_date", new { @class = "" })
[/code]
 

Checkbox

[code lang=”html”]
@Html.AngularCheckboxFor(<expression>, <ngModel>, <htmlAttributes | optional>, <ngTrueValue | optional>, <ngFalseValue | optional>)
[/code]

Example:
[code lang=”html”]
@Html.AngularCheckboxFor(model => model.TestBoolean, "val.test_boolean", new { @class = "" })
@Html.AngularCheckboxFor(model => model.TestBoolean, "val.test_boolean", new { @class = "" }, "’YES’", "’NO’")
@Html.AngularCheckboxFor(model => model.TestBoolean, "val.test_boolean", new { @class = "" }, "{val : true}", "{val: false}")
[/code]
 

Radio Button

[code lang=”html”]
@Html.AngularRadioButtonFor(<expression>, <ngModel>, <value>, <htmlAttributes | optional>, <ngValue | optional>)
[/code]

Example:
[code lang=”html”]
@Html.AngularRadioButtonFor(model => model.Icon, "val.icon", "glyphicon-plus")
[/code]

Septu Jamasoka has written 23 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>