2016-06-16 42 views
-1

传送带说“Cr1”正在显示类别。我在下面有另一个旋转木马说“Cr2”,它显示基于从“Cr1”点击的类别的产品。两者的值都从单个JSON填充。现在我的问题是我无法在“Cr2”中显示产品。需要与角度传送带

/** 
 
* Created by Sneha_Subhash on 6/10/2016. 
 
*/ 
 
var myApp = angular.module('myApp', []); 
 
myApp.controller("MasterDetailCtrl", function($scope, $http) { 
 
    $scope.categoryList = [{ 
 
     "id": "1", 
 
     "name": "Banking", 
 
     "productList": [{ 
 
     "productId": "x10001", 
 
     "productName": "Direct Deposit", 
 
     "categoryid": { 
 
      "id": "1", 
 
      "name": "banking" 
 
     }, 
 
     "productURL": "http://bankonsanfrancisco.com/why", 
 
     "productDesc": "High drama ensued after the emergency landing of a Mangaluru-bound " + 
 
      "Jet Airways flight that took off from Kempegowda International Airport (KIA) on Wednesday morning. Fortunately, " + 
 
      "none of the passengers or crew members were injured. They were all evacuated to safety.The flight made an emergency" + 
 
      " landing at KIA 15 minutes after the take off after smoke was detected in the cabin and an engine caught up in flames. " + 
 
      "Jet Airways said that the flight then came back to KIA for an emergency landing. Soon after landing, the Aircraft Rescue and Fire-fighting Team at KIA rushed to the aircraft and evacuated all the 65 passengers and four crew members on board.Ajeet Khare, Managing Director, Canara Lightings, Mangaluru, was one of the passengers, who was flying with his wife.", 
 
     "createddate": "9\/18\/1996", 
 
     "updateddate": "9\/18\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "img1", 
 
      "link2": "img2" 
 
     }], 
 
     "bgimage": "https://images.unsplash.com/photo-1462146449396-2d7d4ba877d7?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=c219903b4e38c5b8109e11a3d33b9748" 
 
     }, { 
 
     "productId": "x10002", 
 
     "productName": "Individual Banking", 
 
     "categoryid": { 
 
      "id": "1", 
 
      "name": "banking" 
 
     }, 
 
     "productURL": "https://www.google.co.in/search?sourceid=chrome-psyapi2&ion=1&espv=2&ie=UTF-8&q=individual%20banking&oq=individual%20banking&aqs=chrome..69i57j0l5.4255j0j7", 
 
     "productDesc": "Short Desc", 
 
     "createddate": "9\/18\/1996", 
 
     "updateddate": "9\/18\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "img1", 
 
      "link2": "img2" 
 
     }], 
 
     "bgimage": "https://images.unsplash.com/photo-1462726625343-6a2ab0b9f020?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=eb6506972ee7685166b2d8b649d29a1b" 
 
     }, { 
 
     "productId": "x10003", 
 
     "productName": "Business Banking", 
 
     "categoryid": { 
 
      "id": "1", 
 
      "name": "banking" 
 
     }, 
 
     "productURL": "http://bankonsanfrancisco.com/why", 
 
     "productDesc": "Short Desc", 
 
     "createddate": "9\/18\/1996", 
 
     "updateddate": "9\/18\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "img1", 
 
      "link2": "img2" 
 
     }], 
 
     "bgimage": "https://images.unsplash.com/photo-1462910211773-a9847b1f0e40?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=600fdca8f6340569864d4f94f5f9dfc1" 
 
     }, { 
 
     "productId": "x10004", 
 
     "productName": "Digital Banking", 
 
     "categoryid": { 
 
      "id": "1", 
 
      "name": "banking" 
 
     }, 
 
     "productURL": "https://localfirstbank.com/business/", 
 
     "productDesc": "Online banking, also known as internet banking, e-banking or virtual banking, is an electronic payment system that enables customers of a bank or other financial institution to conduct a range of financial transactions through the financial institution's website. The online banking system will typically connect to or be part of the core banking system operated by a bank and is in contrast to branch banking which was the traditional way customers accessed banking services. Fundamentally and in mechanism, online banking, internet banking and e-banking are the same thing.", 
 
     "createddate": "9\/20\/1996", 
 
     "updateddate": "1\/20\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "img1", 
 
      "link2": "img2" 
 
     }], 
 
     "bgimage": "https://images.unsplash.com/photo-1464054313797-e27fb58e90a9?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=576bb45620043f729baef96301c9acb6" 
 
     }] 
 
    }, { 
 
     "id": "2", 
 
     "name": "Insurance", 
 
     "productList": [{ 
 
     "productId": "x10005", 
 
     "productName": "Embee Ins. Brokers Ltd.", 
 
     "categoryid": { 
 
      "id": "2", 
 
      "name": "Insurance" 
 
     }, 
 
     "productURL": "http://www.embeegroup.in/", 
 
     "productDesc": "Embee Financial Services Ltd. is an integrated 'Niche' financial services group that provides full range of corporate advisory services to its clients. The services provided include one stop solution to the Corporate & SMEs in areas of Corporate Finance & Investment Banking, Management Consulting, Wealth Management, Legal & Statutory services & Insurance Broking.", 
 
     "createddate": "9\/20\/1896", 
 
     "updateddate": "1\/20\/2014", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "img1", 
 
      "link2": "img2" 
 
     }], 
 
     "bgimage": "https://images.unsplash.com/photo-1464400694175-33544b41703d?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=680f4a54596d9fa9f20a029e297b1360" 
 
     }, { 
 
     "productId": "x10006", 
 
     "productName": "Excellent Insurance Broking Services Ltd.", 
 
     "categoryid": { 
 
      "id": "2", 
 
      "name": "Insurance" 
 
     }, 
 
     "productURL": "http://www.excellentinsurancebroking.com/", 
 
     "productDesc": "Excellent Insurance Broking Services Ltd is one of the leading insurance broking firms that operate on both direct and reinsurance broking licenced & regulated by IRDAI. Backed by more than a decade of experience and a team of highly qualifiedand professionals from Insurance, Reinsurance, Engineering, Finance, Medicine, IT,Legal and Investigation fields. We are based in Hyderabad, India, with a branch in Bangalore is positioned to handle all insurance and reinsurance requirements through exclusive networks of national and international associates and underwriters. We give innovative solutions with highest competence. EIBSL works closely with insurers to negotiate competitive rates to meet the needs of both existing and potential clients.", 
 
     "createddate": "9\/20\/1996", 
 
     "updateddate": "1\/20\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "img1", 
 
      "link2": "img2" 
 
     }], 
 
     "bgimage": "https://images.unsplash.com/photo-1465152251391-e94453ee3f5a?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=2f3699fc4dbc682fbecdc4fa4d5f6cad" 
 
     }] 
 
    }, { 
 
     "id": "3", 
 
     "name": "Automobile", 
 
     "productList": [{ 
 
     "productId": "x10007", 
 
     "productName": "Ford Model T", 
 
     "categoryid": { 
 
      "id": "3", 
 
      "name": "Automobile" 
 
     }, 
 
     "productURL": "https://en.wikipedia.org/wiki/Ford_Model_T", 
 
     "productDesc": "The first car to achieve one million, five million, ten million and fifteen million units sold. By 1914, it was estimated that nine out of every ten cars in the world were Fords", 
 
     "createddate": "9\/20\/1908", 
 
     "updateddate": "1\/20\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "img1", 
 
      "link2": "img2" 
 
     }], 
 
     "bgimage": "http:\/\/www.pmbl-ng.com\/images\/about.jpg" 
 
     }, { 
 
     "productId": "x10008", 
 
     "productName": "Volkswagen Beetle", 
 
     "categoryid": { 
 
      "id": "3", 
 
      "name": "Automobile" 
 
     }, 
 
     "productURL": "https://en.wikipedia.org/wiki/Volkswagen_Beetle", 
 
     "productDesc": "The need for this kind of car, and its functional objectives, were formulated by Joseph Ganz, an engineer whose ideas influenced Adolf Hitler after he saw the car at an auto show. The leader of Nazi Germany wished for a cheap, simple car to be mass-produced for the new road network of his country. He contracted Ferdinand Porsche in 1934 to design and build it, after telling him in 1933 ", 
 
     "createddate": "9\/20\/1938", 
 
     "updateddate": "1\/20\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [{ 
 
      "link1": "http://images.unsplash.com/photo-1454447170982-596ddff4606a?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=98aa2bb815b9839f16822ecdd38e28ae", 
 
      "link2": "http://images.unsplash.com/photo-1452215199360-c16ba37005fe?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=408c70a6e88b50949c51e26424ff64f3" 
 
     }], 
 
     "bgimage": "http://images.unsplash.com/photo-1459902552792-28b7925b06c2?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=999e6d0ae0e189e1959b31677f5a9848" 
 
     }, { 
 
     "productId": "x10009", 
 
     "productName": "Toyota Corolla", 
 
     "categoryid": { 
 
      "id": "3", 
 
      "name": "Automobile" 
 
     }, 
 
     "productURL": "https://en.wikipedia.org/wiki/Toyota_Corolla", 
 
     "productDesc": "The Toyota Corolla is a line of subcompact and compact cars manufactured by Toyota. Introduced in 1966, the Corolla was the best-selling car worldwide by 1974[1] and has been one of the best-selling cars in the world since then. In 1997, the Corolla became the best selling nameplate in the world, surpassing the Volkswagen Beetle.[2] Toyota reached the milestone of 40 million Corollas sold over eleven generations in July 2013.[3] The series has undergone several major redesigns. The name Corolla is part of Toyota's naming tradition of using names derived from the Toyota Crown for sedans. The Corolla has always been exclusive in Japan to Toyota Corolla Store locations, and manufactured in Japan with a twin, called the Toyota Sprinter until 2000. In Japan and much of the world, the hatchback companion since 2006 is called the Toyota Auris. Prior to the Auris, Toyota used the Corolla name on the hatchback bodystyle in various international markets.", 
 
     "createddate": "9\/20\/1966", 
 
     "updateddate": "1\/20\/2015", 
 
     "documents": [{ 
 
      "link1": "url1", 
 
      "link2": "url2", 
 
      "link3": "url3" 
 
     }], 
 
     "videos": [{ 
 
      "link1": "url1", 
 
      "link2": "url2" 
 
     }], 
 
     "screenshot": [ 
 
      "http://images.unsplash.com/photo-1427464407917-c817c9a0a6f6?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=812662922febc6b1006719224d6c3772", 
 
      "http://images.unsplash.com/photo-1452215199360-c16ba37005fe?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=408c70a6e88b50949c51e26424ff64f3" 
 
     ], 
 
     "bgimage": "http://images.unsplash.com/photo-1436262513933-a0b06755c784?ixlib=rb-0.3.5&q=80&fm=jpg&crop=entropy&s=0b6cf0f2bd64f9788f12b2b43c959c11" 
 
     }] 
 
    } 
 

 
    ]; 
 
    $scope.selectedProduct = $scope.categoryList[0].productList[0].productId; 
 
    // $scope.productId = $scope.selectedProduct.productId; 
 
    $scope.selectedCategory = $scope.categoryList[0].id; 
 
    $scope.selectProduct = function(val) { 
 
    //$scope.selectedProduct = val; 
 
    $scope.selectedCategory = val; 
 
    $scope.loadProducts(); 
 
    } 
 

 
    $scope.loadProducts = function() { 
 
    $scope.listOfProducts = null; 
 

 
    // $scope.listOfProducts = $scope.selectedProduct; 
 
    $scope.listOfProducts = $scope.selectedCategory; 
 
    } 
 
});
<!DOCTYPE html> 
 
<html lang="en" ng-app="myApp"> 
 
<head> 
 
    <title>Bootstrap Example</title> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
 
    <link rel="stylesheet" href="http://www.w3schools.com/lib/w3.css"> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> 
 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 
    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script> 
 
    <script src="carousel.js"></script> 
 
    <style> 
 
     .carousel-inner > .item > img, 
 
     .carousel-inner > .item > a > img { 
 
      width: 100%; 
 
      margin: auto; 
 
     } 
 
     .carousel-inner{ 
 
      height: 500px; 
 
     } 
 
     /* .scrolls { 
 
      overflow-x: scroll; 
 
      overflow-y: hidden; 
 
      height: 80px; 
 
      white-space:nowrap 
 
     }*/ 
 
    </style> 
 
</head> 
 
<body ng-controller="MasterDetailCtrl" class="w3-container"> 
 

 
<div class="container"> 
 
    <br> 
 
    <div id="myCarousel" class="carousel slide" data-ride="carousel"> 
 
     <!-- Indicators --> 
 
     <ol class="carousel-indicators"> 
 
      <li data-target="#myCarousel" data-slide-to="0" class="active"></li> 
 
      <li data-target="#myCarousel" data-slide-to="1"></li> 
 
      <li data-target="#myCarousel" data-slide-to="2"></li> 
 
      <li data-target="#myCarousel" data-slide-to="3"></li> 
 
     </ol> 
 

 
     <!-- Wrapper for slides --> 
 
     <div class="carousel-inner" role="listbox"> 
 
      <div class="item active"> 
 
       <img src="images/vase.jpg" alt="Chania" width="460" height="300"> 
 
       <div class="carousel-caption"> 
 
        <h3>Vase</h3> 
 
        <p>The atmosphere in Chania has a touch of Florence and Venice.</p> 
 
       </div> 
 

 
      </div> 
 

 
      <div class="item"> 
 
       <img src="images/shell.jpg" alt="Chania" width="460" height="300"> 
 
       <div class="carousel-caption"> 
 
        <h3>Sea Shell</h3> 
 
        <p>The atmosphere in Chania has a touch of Florence and Venice.</p> 
 
       </div> 
 
      </div> 
 

 
      <div class="item"> 
 
       <img src="images/turtle.jpg" alt="Flower" width="460" height="300"> 
 
       <div class="carousel-caption"> 
 
        <h3>Turtle</h3> 
 
        <p>The atmosphere in Chania has a touch of Florence and Venice.</p> 
 
       </div> 
 
      </div> 
 

 
      <div class="item"> 
 
       <img src="images/elephant.jpg" alt="Flower" width="460" height="300"> 
 
       <div class="carousel-caption"> 
 
        <h3>Elephant</h3> 
 
        <p>The atmosphere in Chania has a touch of Florence and Venice.</p> 
 
       </div> 
 
      </div> 
 
     </div> 
 

 
     <!-- Left and right controls --> 
 
     <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"> 
 
      <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> 
 
      <span class="sr-only">Previous</span> 
 
     </a> 
 
     <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"> 
 
      <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> 
 
      <span class="sr-only">Next</span> 
 
     </a> 
 
    </div> 
 
    <div class="well text-center"> 
 
     Purposeful AI, when applied to the enterprise, can unlock human potential and amplify people’s ability to do more. To realize this, organizations need to be able to do three things: manage organizational knowledge, apply it to automate enterprise processes, and utilize the massive intelligence hidden away in systems, machines and people. 
 
     Infosys Mana is a knowledge-based AI platform. It brings machine learning together with the deep knowledge of an organization to drive automation and innovation. This enables businesses to continuously reinvent their system landscapes. Mana, with the Infosys AiKiDo service offerings, dramatically lowers the cost of maintenance for both physical and digital assets. It captures the knowledge and know-how of people across fragmented and complex systems, and simplifies the continuous renovation of core business processes. Mana also enables businesses to bring new, delightful user experiences leveraging state-of-the-art technology. 
 
    </div> 
 
    <div class="well"> 
 
     <header> 
 
      <ul class="nav nav-pills nav-justified scrolls"> 
 
       <li data-target="#myCarousel" data-slide-to="0" class="active"> 
 
        <a href="#">About<small>Lorem ipsum dolor sit</small></a> 
 
       </li> 
 
       <li ng-repeat="category in categoryList"><a href="#"><i class="fa fa-home" ng-click="selectproduct(category);"></i> 
 
        {{category.name}}</a> 
 
       </li> 
 

 
      </ul> 
 
     </header> 
 
     <div class = "well" id ="productDetails"> 
 
      <div class="productCard"> 
 
       <div class="w3-card-4" style="width:30%;" ng-repeat="product in categoryList.productList"--> 
 

 
        <header class="w3-container w3-blue"> 
 
         <h1>Header{{product.productName}}</h1> 
 
        </header> 
 

 
        <div class="w3-container"> 
 
         <p>{{product.productDesc}}</p> 
 
         <p><button class="w3-btn w3-dark-grey">Button</button></p> 
 
        </div> 
 

 
        <footer class="w3-container w3-blue"> 
 
         <h5> <a ng-href="{{selectedProduct.productURL}}">{{selectedProduct.productURL}}</a></h5> 
 
        </footer> 
 

 
       </div> 
 
      </div> 
 
     </div> 
 
    </div> 
 

 
</div> 
 

 
</body> 
 
</html>

+0

你的问题不清楚我曾经我想出旋转木马文本有问题,它是你的意思 –

+0

我想从“Cr1”点击的类别中填充第二个旋转木马“Cr2”。第一个轮播展示了其下有各种产品的类别。根据我点击第一个旋转木马上的项目第二个旋转木马应该填充 –

回答

0

检查这方面的帮助,你的问题不清楚,在这个固定传送带请

https://plnkr.co/edit/tJKid1pCREnRP9iMvP2n?p=preview

添加你的CSS

.carousel-caption { 
    position: inherit !important; 
    right: 0 !important; 
    bottom: 0 !important; 
    left: 0 !important; 
     } 
+0

对不起,我的意思是说部分显示在说明(标题部分)下面有“银行”“保险”等......这些是类别,我需要显示产品是类别的对象点击特定的类别在ID =“productDetails” –