How to capture parameter passed via Angular JS Factory in PHP page

Asked

Viewed 96 times

0

How to capture [on a PHP page] the value of input below using factory angularjs?

HTML:

<input type="text" name="edicao" ng-model="edicao" 
value="<?php if(isset($_GET['edicao'])){echo $_GET['edicao'];}else{}?>" />

Angularjs:

factory.autosave = $resource('actions/autosave.php', {}, {});
  • try thus Factory.autosave = $Resource('actions/autosave.php', {edit: $Scope.edit}, {}); So it will send a json object in the body of the request that has the attribute "issue" and its value.

  • 1

    Hi @Hugolima, it so happens that the factory.autosave is out of the controller. That is to say, $scope is not defined.

  • In your controller you must have Factory instantiated, it is in the controller that you send the objects for the request.... Factory.autosave.get({edit: $Scope.edit},{},Function(return){//logic});

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.