1
角度とJavascriptに本当に新しい - 私と私はこのような選択角度があります。リファクタリング角度コントローラ
<select class="form-control" ng-hide="Catalogos.length==0" ng-change="filtro(selected)" ng-model="selected" ng-options="item.Nombre for item in Catalogos "></select>
をそして私は、コントローラに別の関数内の機能を持っていますが、私はそれらの機能を分離します。
私はこのようなものがあります:
$scope.filtro = function(selected) {
$scope.selectedID = selected.ID;
$scope.insertar = function() {
$scope.selectedID = selected.ID;
if ($scope.catalogoid != null) {....
をしかし、私はその変更を行うことができますどのように、オープン$scope.insertar
前1 $scope.filtro
を閉じ、$scope.filtro
の$scope.selectedID
を呼び出し、$scope.insertar
に呼びたいですか? Sajeetharanコメントとしてよろしく
UPDATE
私は
$scope.filtro = function (selected) {
$scope.selectedID = selected.ID;
$scope.insertar(selected);
}
$scope.insertar = function (selected) {
$scope.selectedID = selected.ID;
if ($scope.catalogoid != null) {
を行うしかし、私はselected is udefined
取得。誰も助けてくれますか?あなただけの最初の内側の第2の機能を呼び出すことができます
私はそれを行うが、私はただのgettin選択が – Ledwing
トライ更新の$ scope.insertar =機能(選択)に定義されていません{ – Sajeetharan
は未定義得続けます:/ – Ledwing