I have a form with three input fields:
<form name="myForm" novalidate ng-controller="MainController as vm">
<div>
<input type="text" ng-model="vm.id" name="idInput" required>
<input type="email" ng-model="vm.email" name="emailInput" required>
<input type="text" ng-model="vm.output" name="output">
</div>
</form>
vm.output is a variable defined in my controller that contains some strings plus vm.id and vm.email:
vm.output = 'myurl.com?id=' + vm.id + '&email=' + vm.email;
I want to generate an output URL based on the user input in the id and email fields. However, the output-field does not update when I enter some input into the two other fields. It just says myurl.com?id=undefined&email=undefined,
I can get it working if I use
ng-value="'myurl.com?id=' + vm.id + '&email=' + vm.email"
However, I'm using ng-clip which gets the content to copy by using ng-model so I need to use that.
Also, here's my controller:
angular
.module("app")
.controller("MainController",[MainController);
function MainController(){
var vm = this;
vm.output = 'myurl.com?id=' + vm.id + '&email=' + vm.email;
}
Any suggestions?
{{and}}?vm.output = "myurl.com?id=" + {{vm.id}} + "&email=" + {{vm.email}};``MainController as vminstead of$scope