나는이 $ 범위에서 간단한 console.log()
을 만들려고 노력 해요 : 이것은 내 자바 스크립트 파일이
<div ng-controller="CustomerController" id="customer-block">
<h3>Customer Information</h3>
<div class="col-md-4">
<label>Address 1:</label>
<input type="text" ng-model="customer.address1" class="form-content"
id="customer-address1" />
</div>
<div class="col-md-4">
<label>Address 2:</label>
<input type="text" ng-model="customer.address2" class="form-content"
id="customer-address2" />
</div>
<div class="col-md-4">
<label>City</label>
<input type="text" ng-model="customer.city" class="form-content"
id="customer-city" />
</div>
</div>
입니다
:lima3app.controller("CustomerController", function($scope){
console.log($scope.customer);
});
그러나 로그에 이 정의되지 않은으로 반환됩니다. 그게 뭐가 잘못 됐니? 그 시간에 $의 scope.customer에서의 CustomerController 컨트롤러를 초기화하기 때 값이없는 그것은 정의되지 않은 반환 http://plnkr.co/edit/MU2i46o03bs22Jwh6QIe
'$ scope.customer'는 어디에서도 초기화되지 않으므로 정의되지 않아야합니다. 이러한 입력에 내용을 입력하면 데이터가 시작됩니다. – runTarm