Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 链接表单以检索多个范围信息_Javascript_Angularjs_Controller - Fatal编程技术网

Javascript 链接表单以检索多个范围信息

Javascript 链接表单以检索多个范围信息,javascript,angularjs,controller,Javascript,Angularjs,Controller,对不起打扰了。我正在努力解决一个问题,希望能得到一些帮助。所以我有一个表格,我需要选择一个国家。当我验证时,它必须给我两个div。一个写着国家的名字,另一个写着当地的语言。在这种情况下,我将以阿富汗为例 所需的信息已经在控制器中声明,当我尝试检索它们时,它会提供范围内的所有信息,而我只想在第一个分区中检索所选国家的名称,在第二个分区中检索口语 此外,如果我能有一个小提示,告诉我如何将表单中的选项链接到将要显示的数据,我将不胜感激 我的表格 我的结果显示 分层类型学 对NIF格式的控制 支付ch

对不起打扰了。我正在努力解决一个问题,希望能得到一些帮助。所以我有一个表格,我需要选择一个国家。当我验证时,它必须给我两个div。一个写着国家的名字,另一个写着当地的语言。在这种情况下,我将以阿富汗为例

所需的信息已经在控制器中声明,当我尝试检索它们时,它会提供范围内的所有信息,而我只想在第一个分区中检索所选国家的名称,在第二个分区中检索口语

此外,如果我能有一个小提示,告诉我如何将表单中的选项链接到将要显示的数据,我将不胜感激

我的表格 我的结果显示

分层类型学

对NIF格式的控制

支付choisi:{{places}} 第二语言:{{}
基本上,您的代码如下所示:

<fieldset ng-controller="PlaceController">
    <select ng-model="selectedPlace" ...></select>
</fieldset>
<article ng-controller="PlaceController">
    {{places}}
</article>
将数据移动到
PlaceController
这是匹配码() 它应该验证输入的值。但不太可能工作,因为这是一个选择

var app = angular.module('countriestolanguagesApp', []);

app.controller('PlaceController', function($scope, $http) {

$scope.codeSent = window.location.search //URL parameter to take for future use
$scope.currentElem = {};
$scope.matchCode = function() {
//Go through the tin list and compare
$scope.data.forEach(function(element){
  if (element.code === $scope.codeSent) {
    $scope.currentElem = element;
    return true;
  })
  return null;
}

如果你想添加信息,你应该编辑你的问题,而不是回答
<article ng-app="countriestolanguagesApp" ng-controller="PlaceController">
<div class="container">
  <h2 class="red">Typologie des tiers</h2>
  <p class="red">Contrôle de format unitaire des NIF (Numéro d'Identification Fiscale</p>
  <div class="table-responsive">

          <div >
            Pays choisi : {{places}}
          </div>

          <div>
            Langues parlées : {{}}
          </div>
  </div>
</div>
</article>
<fieldset ng-controller="PlaceController">
    <select ng-model="selectedPlace" ...></select>
</fieldset>
<article ng-controller="PlaceController">
    {{places}}
</article>
<div ng-controller="PlaceController">
    <fieldset>
        <select ng-model="selectedPlace" ...></select>
    </fieldset>
    <article>
        {{places}}
    </article>
</div>
var app = angular.module('countriestolanguagesApp', []);

app.controller('PlaceController', function($scope, $http) {

$scope.codeSent = window.location.search //URL parameter to take for future use
$scope.currentElem = {};
$scope.matchCode = function() {
//Go through the tin list and compare
$scope.data.forEach(function(element){
  if (element.code === $scope.codeSent) {
    $scope.currentElem = element;
    return true;
  })
  return null;
}