如何将角度js连接到节点js

时间:2016-07-16 21:26:55

标签: angularjs node.js

  

这是我的html文件Bootstrap   例   HREF = “http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css” >      SRC = “https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js” >    

           

//获取模态var modal =   的document.getElementById( 'myModal'); //获取图像并插入   在模态中 - 使用其“alt”文本作为var img =   的document.getElementById( 'myImg'); var modalImg =   的document.getElementById( “IMG01”); var captionText =   的document.getElementById( “字幕”); img.onclick = function(){   modal.style.display =“block”; modalImg.src = this.src; modalImg.alt =   this.alt; captionText.innerHTML = this.alt; } //获取   关闭模态var span =的元素   document.getElementsByClassName( “关闭”)[0]; //当用户点击时   on(x),关闭模态span.onclick = function(){   modal.style.display =“none”; }    

          切换导航主页     蛋糕

  • 菠萝
  • 白饼
  • 水果蛋糕
  • 礼物
  • AllGIFTS
  • 软玩具
  • 个性化礼品
  • 鲜花组合

       <!-- Wrapper for slides -->
        <div class="carousel-inner" role="listbox">
            <div class="item active">
         <img src="63hB3f3.jpg" alt="Chania">
         < div class="carousel-caption">
        ...
         </div>
        </div>
         <div class="item">
          <img src="Whiteforest-Cake-6.jpg" alt="Chania">
          <div class="carousel-caption">
           ...
         </div>
        </div>
         ...
        </div>
    
      <!-- Controls -->
        <a class="left carousel-control" href="#carousel-example-
           generic"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="#carousel-example
             -generic" 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="row">
            <div class="col-md-2 col-sm-4 col-xs-6 ">
             <a href="greeting-card-large.jpg" class="thumbnail ">
    
             <img id="myImg" src="greeting-card-large.jpg" 
          alt="Pulpit Rock"     style="width:150px;height:150px" >
    
    
    </a>   </div>   <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="G08-247x250.jpg" class="thumbnail ">
    
      <img src="G08-247x250.jpg" alt="Moustiers Sainte Marie" style="width:150px;height:150px" id="G08-247x250.jpg">
    
    
    
    </a>   </div>   <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="cpg159-247x250.jpg" class="thumbnail cake1">
    
      <img src="cpg159-247x250.jpg" alt="Cinque Terre" style="width:150px;height:150px" id="cpg159-247x250.jpg">
    
    </a>   </div>   <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="choco-vanilla-cake-5.jpg" class="thumbnail cake2">
    
      <img src="choco-vanilla-cake-5.jpg" alt="Pulpit Rock" style="width:150px;height:150px" id="choco-vanilla-cake-5.jpg">
    
    </a>   </div>   <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="Whiteforest-Cake-6.jpg" class="thumbnail cake3">
    
      <img src="Whiteforest-Cake-6.jpg" alt="Moustiers Sainte Marie" style="width:150px;height:150px" id="Whiteforest-Cake-6.jpg">
    
    </a>   </div>   <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="Combo-deal-27.jpg" class="thumbnail combo1">
    
      <img src="Combo-deal-27.jpg" alt="Cinque Terre" style="width:150px;height:150px" id="Combo-deal-27.jpg">
    
    </a>   </div>   <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="Combo-deal-22.jpg" class="thumbnail combo2">
    
      <img src="Combo-deal-22.jpg" alt="Cinque Terre" style="width:150px;height:150px" id="Combo-deal-22.jpg">
    
    </a>   </div>   <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="Combo-deal-241.jpg" class="thumbnail combo3">
    
      <img src="Combo-deal-241.jpg" alt="Cinque Terre" style="width:150px;height:150px" id="Combo-deal-241.jpg">
    
    </a>   </div>
     <div class="col-md-2 col-sm-4 col-xs-6">
    <a href="heart-shape-cake-111.jpg" class="thumbnail cake4">
    
      <img src="heart-shape-cake-111.jpg" alt="Cinque Terre" style="width:150px;height:150px" id="heart-shape-cake-111.jpg">
    
    </a>   </div> </div> </div> </div> </body> </html>
    
         

    这是mysqldemo.js(节点js文件)

         

    var mysql = require('mysql'); var connection = mysql.createConnection({               主持人: 'localhost' 的,         用户: 'satheesh',         密码: 'muthyala @ 1991!',         数据库: 'satheesh',         port:3306});

         

    connection.connect(); var query = connection.query('select * from   details',function(err,result,fields){if(err)throw err;   的console.log( '结果:',结果); }); connection.end();

    0 个答案:

    没有答案