저는 AngularJS로 처음 작성하려고하는데 개발자가 아닙니다. 저는 프로그래밍을 매우 시작하고 있습니다.범위에 다른 값을 지정하고 하나만 호출 할 때
여기 내 문제가 있습니다. 내가 var ouinon
에 지정하려면 $scope.colors
에 지정하고, 사용자가 선택한 색상의 값을 프론트 오피스에 입력합니다. ... 작동하지 않습니다 $scope.colors.name
퍼팅 물론
그것은 당신이 쉽게 보일 수
(CONSOLE.LOG에, 그것은 "정의되지 않은"이다),하지만 난 내가 잘못 뭘하는지 볼 수 없습니다.
JS 부 :
function LookCtrl($scope, $http){
$scope.colors = [
{name:'blue', shade:'femme'},
{name:'red', shade:'femme'},
{name:'yellow', shade:'femme'},
{name:'blue', shade:'homme'},
{name:'red', shade:'homme'}
];
$scope.myColor = $scope.colors[2];
var ouinon = "http://api.shopstyle.fr/api/products?pid=uid7689-25635133-51&cat="
+ $scope.colors.name + "&limit=60&fl=d0&sort=Popular";
$http.get(ouinon).success(function(data){
$scope.look = data;
});
HTML 부 : 간단한 측면에서
<section ng-controller="LookCtrl" ng-init="init()" class="panel panel-padding left"
ng-class="{center:panel==1, right:panel<1}">
<h1>Selection: </h1>
<select ng-model="myColor"
ng-options="color.name group by color.shade for color in colors">
</select>
안녕하세요 새로운 데브, 나를 위해 당신의 코드가 작동. 방아쇠를 가져 주셔서 감사합니다, 그것에 대해 생각하지 않았습니다 :) – Pourgroud