我有一个工厂,它返回我的文章模型的$资源:
angular.module('ADI.Resources').factory("Articles", ['$resource', function($resource) {
return $resource('/api/v1/article/:articleId', {
articleId: '@_id',
_shop: window.user._shop
}, {
update: {
method: 'PUT'
}
});
}]);
Run Code Online (Sandbox Code Playgroud)
GET,POST并且DELETE运行良好,但不是更新(PUT).这是我使用的代码:
Articles.update({articleId: '300000000000000000000001'}, function(article){
console.log(article);
});
Run Code Online (Sandbox Code Playgroud)
这是在提出这个要求:
PUT http://localhost:3000/api/v1/article?_shop=100000000000000000000001
Run Code Online (Sandbox Code Playgroud)
代替:
PUT http://localhost:3000/api/v1/article/300000000000000000000001?_shop=100000000000000000000001
Run Code Online (Sandbox Code Playgroud)
知道为什么在执行更新时没有填充:articleId参数?谢谢!
我正在尝试理解"榆树制作"命令.我建了2个.elm文件调用Foo.elm和Bar.elm.我想在这种格式的HTML文件中显示它们:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="elm.js"></script>
</head>
<body>
<h2>Foo</h2>
<div id="foo-app"></div>
<h2>Bar</h2>
<div id="bar-app"></div>
</body>
<script type="text/javascript">
Elm.embed(Elm.Foo, document.getElementById("foo-app"));
Elm.embed(Elm.Bar, document.getElementById("bar-app"));
</script>
</html>
Run Code Online (Sandbox Code Playgroud)
但Elm.Foo与Elm.Bar不存在.只有Elm.Main.
试图用这个命令编译:elm make Foo.elm Bar.elm --output elm.js.我究竟做错了什么 ?
我正在尝试构建游戏的用户界面,AngularJS似乎是完美的.我的所有游戏都在全局变量中ig.ig看起来像这样:
ig = { money: 100, lives: 3, ... };
Run Code Online (Sandbox Code Playgroud)
我想补充ig.money和ig.live控制器的范围,所以它会自动更新的用户界面时,游戏内的变量的变化.
我试过了 :
$scope.$watch('ig.money', function() { $scope.money = ig.money; });
Run Code Online (Sandbox Code Playgroud)
但它不起作用.它说这ig是空的.有人能指出我正确的方向吗?谢谢