-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ac-options and ac-model attributes must be set #14
Comments
What have you set the ac-model attribute to? Have you defined it on the scope? It needs to be initialised either to null or one of the items in the job array. |
here is my post on stackoverflow. if you need more information let me know |
On 22/10/2014 22:03, texas697 wrote:
|
thank you! |
Sorry I've not had a chance to get a demo up and running on Plunker yet, but looking at your markup on stackoverflow I see a couple of issues. You have ac-model set as "currentItem.JobItems[0].JobItemName", but I think that will be undefined when acute select initialises. You need a separate scope variable for the model, e.g. $scope.jobItemModel, and set it to null at the top of your controller. Then set it to the first job item when you've got the data from the server. Also, in ac-options, shouldn't "currentItem.JobItems.JobItemName" be "currentItem.JobItems[0].JobItemName"? Hope this is of some help. John |
Hey John, is there an update on this, I am also seeing the same error on the console but select shows up just fine |
If you're getting the message "ac-options and ac-model attributes must be set", even though you've set the attributes, it's most likely because the scope variable pointed to by the ac-model attribute is undefined when ac-select initialises. E.g. if you have ac-model="myModel", try including the line
or
at the start of your controller. |
This helped me getting rid of this error on my project. $scope.listOfCurrencies = null;
$scope.modelCurrency = null;
$http({
method: "GET",
url: defaults.dataUrl,
cache: false
}).success(function(res, err) {
$scope.listOfCurrencies = res.data;
}); |
Hi there,
When I wrote acute select there wasn't an alternative that had the features I needed, and though it worked for my purposes, I now feel it has too many issues for me to recommend using it. There are some good alternatives now. UI Select, in particular, looks very promising, so I'd suggest trying that:- http://angular-ui.github.io/ui-select/
Kind regards,
John
…-----Original message-----
From: ROJAHEMA [email protected]
Date: Tue, 06 Jun 2017 05:43:28 +0100
To: john-oc/acute-select [email protected]
Subject: Re: [john-oc/acute-select] ac-options and ac-model attributes must beset (#14)
Hey john,
after declaring also am facing the same issue.. Can you please guide me.
ac-options and ac-model attributes must be set <ac-select ac-model="hospitalData.hospitalName" ac-options="hospital.hospitalName as hospital.hospitalName for hospital in hospNameList" ac-change="selectionChanged(value)" ac-settings="{ loadOnOpen: true }" class="ng-isolate-scope">
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#14 (comment)
|
I am trying to get this working with my project but I am having trouble. I have copied and pasted your example code into my project and I am getting this error.
ac-options and ac-model attributes must be set
I would like to use this, currently I am using Angular-Ui typeahead directive. This is how I am using it. If you could show me how to transition I would be grateful. thank you
Here is where I am getting the jobArray
//GET Jobs
$scope.jobArray = {};
JobGet.query().then(function (data) {
$scope.jobArray = data;
}, function (reason) {
errorMngrSvc.handleError(reason);
});
The text was updated successfully, but these errors were encountered: