1

The page generates a table and when a user clicks on the row's edit button, an edit popup displays. In the popup and tetxboxes, textareas, etc. work fine. The dropdown fills with values.

If have stripped the code of lots of things saw you can see the code that really matters.

I am unable to set the initial dropdown value in the popup. The dropdown loads but the first row is blank and that is is pointed to upon display of the popup.

I have tried every conceivable way that I found on the internet to do it including hardcoding the value. But noooo, nothing works. There are many stupid ways that I tried that I removed from the code.

Removed bad code. Used single controller as recommended by ThinkingMedia.

9
  • You can't use both ng-model and ng-selected on the same select tag. You should only have to use ng-model, and don't use ng-init either. I have no idea what results you would get by mixing those directives, but it not working would be one of my guesses. Commented Apr 27, 2017 at 16:56
  • I removed ng-init AND ng-selected but same results. I was trying all sorts of stuff.. I'll update the code above to remove them. Commented Apr 27, 2017 at 17:26
  • I would add {{ Alpha.selectedTempltKind | json }} above the <select> tag. This will print the current selection as JSON in the popup. That way you can see if you are actually setting a valid default value. Commented Apr 27, 2017 at 17:40
  • Also, you are missing a close > character in the <option> tag. Don't know if that's just in your post or the original template. Commented Apr 27, 2017 at 17:42
  • 1
    You have the APIController assigned 3 times in the HTML. I think this is the problem as the two inner controllers share the same $scope with the parent APIController. Their constructor functions are called and Alpha gets assigned a new factEdit instance. It's hard to say which Alpha instance is really being used at different points in the code. Use only 1 controller. Commented Apr 27, 2017 at 18:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.