私はAngularJSを学び、HTTPサービスを呼び出すときにボタンクリック後にユーザーが入力したテキストボックスのテキスト値を渡して文字列url値に追加する際に助けが必要です。コントローラでanglejsのテキストボックス値にアクセスする
私は次のように追加しようとしていますが、テキストボックスからユーザーが入力したテキストでURlを追加している間、私には未定義の値が表示されています。ここで
は、誰もが、ユーザが入力した正しい値を取得する方法についてこの点で私を助けることができる私のHtmlPage1.html
<form ng-submit="abc(inputValue)">
<input type="text" name="name" ng-model="inputValue" />
<button type="submit">Test</button>
</form>
と私のスクリプトファイルScript.js
var app = angular.module("repos", [])
.controller("reposController", function ($scope, $http, $log) {
$scope.inputValue = null;
$scope.abc = function (value) {
$scope.inputValue = value;
};
$http({
method:'GET',
url: 'https://api.github.com/users/'+$scope.inputValue+'/repos'
})
.then(function (response) {
$scope.repos = response.data;
$log.info(response);
});
});
ですURLに追加するには?
ありがとうございます。