Hi all,
I'm having an hard time trying to fetch the $viewValue from a typeahead
component nested inside a custom template.
This is scenario:
1. template.html:
<input type="text" data-ng-model="address.country" value="{{
address.country }}" placeholder="Country" data-typeahead="country.name for
country in suggestCountry($viewValue)" class="form-control">
2. directive:
app.directive('editAddress', function() {
return {
restrict: 'AE',
scope: {
address: "=",
hasBilling: "=",
showSaveOnly: "=",
onSave: "&",
onReset: "&",
onDelete: "&",
suggestCountry: "&",
suggestCity: "&",
suggestState: "&",
},
templateUrl: 'template.html'
};
});
3. directive call:
<edit-address suggest-country="suggestCountry(value)" show-save-only="true"
address="newAddress" has-billing="false" on-save="SaveNewAddress()"
></edit-address>
4. inside controller:
$scope.suggestCountry = function(valTyped) {
var promise = CommonServices.FetchCountries(valTyped);
promise.then(function(data) {
return data;
});
return promise;
};
Something is telling me that I should use link but I dont really see why
and how!
Thanks,
Tobias
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.