मैं codepen में निम्नलिखित कोड का उपयोग कर रहा है और इस मुद्दे का सामना करना पड़, conctact के लिए मैं निम्न त्रुटिकोणीय में कुछ चर के लिए त्रुटि परिभाषित नहीं है?
क्यों यह संपर्क के लिए और नाम के लिए नहीं त्रुटि दे रहा है मिल रहा है?
मैं इसे कैसे हल कर सकता हूं?
angular.js:13550 ReferenceError: contact is not defined
at new <anonymous> (pen.js:8)
at Object.invoke (angular.js:4665)
at R.instance (angular.js:10115)
at n (angular.js:9033)
at g (angular.js:8397)
at g (angular.js:8400)
at angular.js:8277
at angular.js:1751
at n.$eval (angular.js:17229)
at n.$apply (angular.js:17329)
यहाँ JS फ़ाइल है
var app = angular.module("crud", []);
app.controller("ctrl", ['$scope', function($scope) {
$scope.data = [3, 4, 5, 34, 34];
debugger;
$scope.name = name;
$scope.contact = contact;
$scope.obj = {
name: $scope.name,
contact: $scope.contact
};
console.log($scope.obj);
}]);
यहाँ HTML फ़ाइल है कि मैं का उपयोग कर रहा है।
<body ng-app="crud">
<div ng-controller="ctrl">
<div>
<table>
<tr ng-repeat="x in data track by $index">
<td>{{x}}</td>
<td>{{$index}}</td>
</tr>
</table>
</div>
</div>
</body>
कृपया इन सवालों
- क्यों यह संपर्क में विफल हो रहा है और नाम पर नहीं का जवाब?
- संपर्क संख्या डेटा है, मुझे इसे डिफ़ॉल्ट मान क्या देना चाहिए?
स्वीकार करेंगे क्या आप संपर्क है कि आप '$ scope.contact' को बताए जाते हैं में मिल रहा है? –