0

ng-if のマップに値が存在するかどうかをテストするにはどうすればよいですか?

$scope.textInputTypes = {
      "currency": true,
      "double": true,
      "percent": true,
      "int": true,
      "email": true,
      "phone": true,
      "string": true,
      "textarea": true,
      "url": true
    };

ng-if='mytype in textInputTypes'

これは私にエラーを与えます:

構文エラー: トークン 'in' は、[in textInputTypes] で始まる式 [mytypeNaNn textInputTypes] の列 17 にある予期しないトークンです。

4

2 に答える 2

0

最後に、私はそれを行う方法を見つけました。

ng-if="textInputTypes[myType]"

于 2015-07-25T21:34:50.710 に答える