मेरे पास एक लंबी सूचीदृश्य में कई आइटम हैं। Mypage.html # the_item_id पर जाकर मेरे उपयोगकर्ता एक विशिष्ट आइटम पर (यानी बुकमार्क) कैसे जा सकते हैं?कोणीय के आंशिक दृश्य में एंकर पर कैसे कूदें?
असल में, जब मैं इनलाइन व्यू [नमूना 1] का उपयोग कर सकता हूं, लेकिन जब मैं आंशिक दृश्य [नमूना 2] का उपयोग नहीं करता हूं। क्या बाद के मामले में कोई बग है, या मुझे किसी भी कामकाज का उपयोग करना चाहिए?
अग्रिम धन्यवाद!
नमूना 1: आप page.html # A100 यात्रा कर सकते हैं देखने के लिए आइटम 100 ::
<!doctype html>
<html ng-app>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<script>
function MainCtrl($scope){
$scope.items = [];
for(var i=0; i<200; i++){$scope.items.push({id: i})}
}
</script>
</head>
<body ng-controller='MainCtrl'>
<div>
<ul>
<li ng-repeat="i in items"><a id='a{{i.id}}'>{{i.id}}</a></li>
</ul>
</div>
</body>
</html>
नमूना 2: page2.html # A100 पर नहीं जा सकते आइटम 100 को देखने के लिए, क्यों? ::
<!doctype html>
<html ng-app>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js"></script>
<script>
function MainCtrl($scope){
$scope.items = [];
for(var i=0; i<200; i++){$scope.items.push({id: i})}
}
</script>
</head>
<body ng-controller='MainCtrl'>
<div ng-include="'scroll_view.html'"><!-- MUST use "'...'" notation here --></div>
</body>
</html>
और यह scroll_view.html नमूना 2 ::
<div>
<ul>
<li ng-repeat="i in items"><a id='a{{i.id}}'>{{i.id}}</a></li>
</ul>
</div>
मुझे एक ही समस्या है। क्या आपको अभी तक कोई समाधान मिला है? जो मैंने खोजा है, उससे समस्या यह है कि jqlite 'element.getElementById' 'स्क्रॉल' फ़ंक्शन के अंदर शून्य हो रहा है। शायद क्योंकि सामग्री अभी तक डोम में मौजूद नहीं है? – NilsH