小编cla*_*re_的帖子

超薄框架基础URL

我是Slim Framework的新手.如何使用Codeigniter函数获取基本URL base_url()?

谢谢

php slim

7
推荐指数
3
解决办法
3万
查看次数

$ httpBackend(angularJS)中的URL参数

是否可以在angularJS的$ httpBackend中接收URL参数?我想做的事情如下:

$httpBackend.whenGET('/api/v1/users/{userId}').respond(function (method, url, data) {
    // somehow read {userId} and act differently depending on what the value is

    return [200];
});
Run Code Online (Sandbox Code Playgroud)

拥有这个功能真的可以很容易地创建一个功能相当的模拟API(更容易开发前端应用程序而无需运行整个后端).

angularjs

6
推荐指数
1
解决办法
1724
查看次数

AngularJS-PUT方法不起作用(404错误)

我是AngularJS的新手,无法通过REST更新对象。我正在使用PHP / Mysql后端(Slim框架)。
我能够检索(GET),创建(POST)一个新对象,但不能编辑(PUT)一个对象。这是代码:

我的表格:

<form name="actionForm" novalidate ng-submit="submitAction();">
  Name: <input type="text" ng-model="action.name" name="name" required>
  <input type="submit">
</form>
Run Code Online (Sandbox Code Playgroud)

我的服务:

var AppServices = angular.module('AppServices', ['ngResource'])
AppServices.factory('appFactory', function($resource) {
  return $resource('/api/main/actions/:actionid', {}, {
    'update': { method: 'PUT'},
  });
});
Run Code Online (Sandbox Code Playgroud)

app.js

var app = angular.module('app', ['AppServices'])
app.config(function($routeProvider) {
  $routeProvider.when('/main/actions', {
    templateUrl: 'partials/main.html',
    controller: 'ActionListCtrl'
  });
  $routeProvider.when('/main/actions/:actionid', {
    templateUrl: 'partials/main.html',
    controller: 'ActionDetailCtrl'
  });
  $routeProvider.otherwise({redirectTo: '/main/actions'});
});
Run Code Online (Sandbox Code Playgroud)

controllers.js:

function ActionDetailCtrl($scope, $routeParams, appFactory, $location) {
  $scope.action = appFactory.get({actionid: $routeParams.actionid});
  $scope.addAction = function() {
    $location.path("/main/actions/new");
  }
  $scope.submitAction …
Run Code Online (Sandbox Code Playgroud)

rest put slim angularjs

2
推荐指数
1
解决办法
9926
查看次数

标签 统计

angularjs ×2

slim ×2

php ×1

put ×1

rest ×1