Commit 56eca23b authored by Tran Anh Tu's avatar Tran Anh Tu
Browse files

Merge branch '1.1.0' of gitlab.dev.appstract.dk:internal/umbracocontactnumber into 1.1.0

parents e75b3cf0 0366ce06
......@@ -19,7 +19,7 @@ angular.module("umbraco").controller("ContactNumberController", function ($scope
"mx": { CountryPhoneCodeList: ["52"], ValidLengths: [10] },
"br": { CountryPhoneCodeList: ["55"], ValidLengths: [10] },
"sg": { CountryPhoneCodeList: ["65"], ValidLengths: [8] },
"my": { CountryPhoneCodeList: ["60"], ValidLengths: [9] },
"my": { CountryPhoneCodeList: ["60"], ValidLengths: [8] },
"in": { CountryPhoneCodeList: ["91"], ValidLengths: [10] },
"af": { CountryPhoneCodeList: ["93"], ValidLengths: [] },
"al": { CountryPhoneCodeList: ["355"], ValidLengths: [] },
......
......@@ -15,6 +15,33 @@ If the number does not have one of the known correct lengths for the country, or
![Turkish phone number. Validity of phone number length is unknown.](images/property-editor-edit-tr.png "Turkish phone number. Validity of phone number length is unknown.")
## Usage
Auto-generated model classes (using the Umbraco Models Builder) will automatically generate properties using the `Appstract.UmbracoContactNumber.ContactNumber` class.
Umbraco will deserialize the value into this class automatically, when having the following property on the model class (the example uses the Model Builder API approach to model generation):
```csharp
namespace ...
{
public class ... : UmbracoContentModel
{
...
///<summary>
/// Phone
///</summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder", "8.1.0")]
[ImplementPropertyType("phone")]
public Appstract.UmbracoContactNumber.ContactNumber Phone => this.Value<Appstract.UmbracoContactNumber.ContactNumber>("phone");
}
}
```
The `ContactNumber` class gives access to the raw information put into the property editor, but also a property that formats the input.
If the country code has been set to `Denmark (+45)` and the number to `98765432`, the `FormattedContactNumber` property will return `+45 98765432`.
# Build steps
## How to build the NuGet package
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment