Hi guys, new here.

I'm a fairly new Javascript developer as well as Angular JS.

The problem is that when I click the edit link next to the testimonial list 
it takes me to the editor with the object id in the nav bar but the content 
box for the testimonial is blank basically it hasn't inject the testimonial 
content into the editor.

The information I'm trying to pull from a REST API service is coming from 
my Loopback API and I am using the Loopback lb-services SDK thats why my 
code may look confusing to the traditional $http method. 
(http://docs.strongloop.com/display/public/LB/AngularJS+JavaScript+SDK)

Please note I have got GET, CREATE, DELATE working just not UPDATE as you 
can see below.

Any way here is what my route looks like 

.state('edit-testimonial', {
    url: '/edit-testimonial/:id',
    templateUrl: 'views/testimonial-editor.html',
    controller: 'EditTestimonialCtrl',
    authenticate: true
  })

Here is what my editor looks like

<h1>Testimonial Editor</h1>
<br />
<form name="form" ng-submit="submitForm()">
<div class="form-group">
 <!-- Testimonial Content -->
<label>Testimonial:</label>
<textarea ng-model="testimonial.content"></textarea>

 <div class="pull-right buttonspacer">
<a href="testimonials" class="btn btn-default btn-lg">Cancel</a> 
<button class="btn btn-default btn-lg">{{ action }}</button>
</div>
</div>
</form>
 
And finally here is what my controller looks like

.controller('EditTestimonialCtrl', ['$scope', 'Testimonial',
      '$stateParams', '$state', function($scope,  Testimonial,
      $stateParams, $state) {
    $scope.action = 'Edit';
    $scope.isDisabled = true;
  
    Testimonial.findById({ id: $stateParams.id })
    .$promise
      
    $scope.submitForm = function() {
      $scope.testimonial
        .$save()
        .then(function(testimonial) {
          $state.go('testimonials');
        });
    };
  }])

Thanks for your time

Joe 

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to