1

In ng-admin edit view I need to change file upload url with id as below , but I don't know how to fetch id of selected entity in uploadInformation base url like {{entry.values.id}} , below is my code :

files.editionView()
            .title('Edit File {{ entry.values.id }}({{       entry.values.filePath}})') // title() accepts a template string, which has  access to the entry
            .actions(['list', 'show', 'delete']) // choose which buttons appear in the top action bar. Show is disabled by default
            .fields([
                nga.field('id').label('id').editable(false),
                nga.field('file', 'file').uploadInformation({ 'url': baseurl     +"files/upload/{{entry.values.id}}"}),// fields() without arguments returns the list of fields. That way you can reuse fields from another view to avoid repetition    
            ])
apurv
  • 71
  • 2
  • 12

1 Answers1

0

{{ entry.values.id }} - is an Angular expression and in this form should be used in HTML not in JavaScript. I assume that entry is your $scope variable, hence you need to write something like this: ... .uploadInformation({ 'url': baseurl+ "files/upload/"+$scope.entry.values.id})

$scope.entry should be prepopulated in your controller's code

Nikolai
  • 198
  • 1
  • 14
  • I am using this code inside app.config() . I am beginner in angular so don't have idea about how can I access $scope there. – apurv Jun 10 '16 at 10:11
  • my suggestion then would be to go through a little introductory course, for example this here: [Learn AngularJS](https://www.codecademy.com/learn/learn-angularjs). Will save you an awful lot of time – Nikolai Jun 10 '16 at 10:13