如何从ng-repeat列表中的单击生成不同的页面?

时间:2016-08-15 15:50:10

标签: javascript jquery html angularjs materialize

我有这个代码,这就是它的作用: 它从json生成主题列表。 这些主题将用于确定“内容”区域中的页面。

但是,如何为该列表中的每个项目调用/创建每个页面的“链接”或“方式”。

存在验证点击了哪个项目的方法?并从该项目中调用相应的页面?

angular.module('duall')
.controller('documentationController', ['$scope', '$http', function($scope, $http){

	$scope.docs = [];

	$http.get('static/titles.json').success(function(doc){
		$scope.docs = doc;
	}).error(function(error){
		console.log(error);
	});

}]);
<div ng-controller="documentationController">
<div class="row">
  
  
  <div  class="col s3" >
    
    <!-- Search Box -->
    <div class="input-field col s12" >      
      <input id="search" type="search" ng-model="q" aria-label="filter docs"/>
             <label for="search">
              <strong>
                Pesquise Algo! :)
              </strong>
             </label>
      <i class="material-icons prefix">search</i>
    </div>
    <!-- End of Search Box -->
    
    <ul class="animate-container">       
      <li  ng-repeat="docs in docs | filter:q as results">
        <a class="" href="{{docs.title}}">
          {{docs.title}}
        </a>
      </li>
      
      <!-- if no results -->
      <li ng-if="results.length === 0">
        <strong>Nada encontrado :(</strong>
      </li>
    </ul>      
        
  </div> <!-- end col s3 -->
  
  <div class="col s9">
      <h1>CONTENT</h1>
  </div><!-- end col s9 -->


</div><!-- end ROW -->
</div><!-- end Controller -->

0 个答案:

没有答案