Fix form field lookup by populating the field name

This commit is contained in:
Marliana Lara 2017-09-07 15:30:25 -04:00
parent 56e9d7b8e2
commit 7965f9df6c
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE

View File

@ -29,10 +29,8 @@ export default ['templateUrl', function(templateUrl) {
$scope.init = function() {
let list = $scope.list;
if($state.params.selected) {
$scope.currentSelection = {
name: null,
id: parseInt($state.params.selected)
};
let selection = $scope[list.name].find(({id}) => id === parseInt($state.params.selected));
$scope.currentSelection = _.pick(selection, 'id', 'name');
}
$scope.$watch(list.name, function(){
selectRowIfPresent();