カスタム入力テキストを取得しようとしています。これが私の見解です
<div>
<span>{{label}}</span>
<input type="text" class="{{class}}" placeholder="{{placeholder}}" ng-style="width?{width: width + 'px'}:{}" ng-model="model"/>
</div>
これが私のコントローラーです
angular.module('inputText', [])
.directive('inputText', function() {
return {
restrict: 'E',
replace: true,
scope: {
width: '@',
label: '@',
class: '@',
placeholder: '@',
model: '@'
},
controller: 'InputCtrl',
templateUrl: 'inputText.html'
};
})
.controller('InputCtrl', ['$scope', function($scope) {
}]);
問題は、次のようなエラー メッセージが常に表示されることです。
Error: [$parse:syntax] Syntax Error: Token 'model' is unexpected, expecting [:] at column 3 of the expression [{{model}}] starting at [model}}].
私の質問は、次のようなものを取得するために、参照によってモデルを渡すにはどうすればよいですか?
<input-text label="When?" class="" placeholder="" icon="awesome-icon" width="150" model="{{when}}"></input-text>