我正在制作一个表单,其中我有一个手机号码的输入字段,但我似乎无法使其正常工作。 PHP代码获取IP并获取国家/地区代码,然后列出可供选择的选项。国家/地区代码,标志和名称位于数组中:
<template [ngIf]="condition"> <--- binds input property ngIf to NgIf directive, not to template
<p>
text here
</p>
</template>
所以,这是一个代码示例,我想要的是复制这样的内容https://www.cognalys.com/#点击&#34; Web Demo&#34;,这里的手机号码字段。我想显示标志,然后输入字段,自动填充拨号代码。任何指导或任何事情都会有所帮助。
答案 0 :(得分:0)
我不认为您正在正确创建国家/地区数组,请尝试以下方式:
$countries = array(
array("code"=>"AF","name"=>"Afghanistan","d_code"=>"+93", "img"=>"https://checkmobi.com/static/images/flags/AF-32.png"),
array("code"=>"AL","name"=>"Albania","d_code"=>"+355", "img"=>"https://checkmobi.com/static/images/flags/AL-32.png"),
array("code"=>"DZ","name"=>"Algeria","d_code"=>"+213", "img"=>"https://checkmobi.com/static/images/flags/DZ-32.png"),
array("code"=>"AS","name"=>"American Samoa","d_code"=>"+1", "img"=>"https://checkmobi.com/static/images/flags/AS-32.png"),
array("code"=>"AD","name"=>"Andorra","d_code"=>"+376", "img"=>"https://checkmobi.com/static/images/flags/AD-32.png")
);