2016-06-10 15 views
1

In ng-Admin Bearbeitungsansicht Ich muss Datei Upload-URL mit ID wie folgt ändern, aber ich weiß nicht, wie ID der ausgewählten Entität in uploadInformation Basis-URL wie {{entry .values.id}}, unten ist mein Code:ng-Admin-Datei uploadInformation get Entitäts-ID

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  
      ]) 

Antwort

0

{{ entry.values.id }} - ein Winkel Ausdruck und in dieser Form sollte in HTML nicht in JavaScript verwendet werden. Ich gehe davon aus, dass entry ist Ihre $scope Variable, daher müssen Sie so etwas schreiben: ... .uploadInformation({ 'url': baseurl+ "files/upload/"+$scope.entry.values.id})

$scope.entry sollte in Ihrem Controller Code

+0

ich diesen Code in app.config bin mit vorbelegt werden(). Ich bin Anfänger in eckig, also habe keine Ahnung, wie ich dort auf $ scope zugreifen kann. – apurv

+0

mein Vorschlag wäre dann, einen kleinen Einführungskurs zu machen, zum Beispiel hier: [Learn AngularJS] (https://www.codecademy.com/learn/learn-angularjs). Wird dir eine Menge Zeit sparen – Nikolai