Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Online AngularJS Editor

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
    <script>
        myApp.factory('Excel',function($window){
		var uri='data:application/vnd.ms-excel;base64,',
			template='<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="https://www.w3.org/TR/REC-html40"><head><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>{worksheet}</x:Name><x:WorksheetOptions><x:DisplayGridlines/></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head><body><table>{table}</table></body></html>',
			base64=function(s){return $window.btoa(unescape(encodeURIComponent(s)));},
			format=function(s,c){return s.replace(/{(\w+)}/g,function(m,p){return c[p];})};
		return {
			tableToExcel:function(tableId,worksheetName){
				var table=$(tableId),
					ctx={worksheet:worksheetName,table:table.html()},
					href=uri+base64(format(template,ctx));
				return href;
			}
		};
	})
	.controller('MyCtrl',function(Excel,$timeout){
	  $scope.exportToExcel=function(tableId){ // ex: '#my-table'
			$scope.exportHref=Excel.tableToExcel(tableId,'sheet name');
			$timeout(function(){location.href=$scope.fileData.exportHref;},100); // trigger download
		}
	});
    </script>
  </head>
  <body >
    <div>
      <label>Name:</label>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">
      <hr>
      <h1>Hello {{yourName}}!</h1>
      <button class="btn btn-link" ng-click="exportToExcel('#table1')">
		<span class="glyphicon glyphicon-share"></span> Export to Excel
	</button>
    </div>
  </body>
</html>

linebotIMGUR

var request = require("request");
var cheerio = require("cheerio");

const linebot = require('linebot');
const express = require('express');

const bot = linebot({
	channelId: process.env.CHANNEL_ID,
	channelSecret: process.env.CHANNEL_SECRET,
	channelAccessToken: process.env.CHANNEL_ACCESS_TOKEN
});

const app = express();

const linebotParser = bot.parser();

app.get('/',function(req,res){
    res.send('Hello World!');
});

app.post('/linewebhook', linebotParser);

//每當server啟動,或是重build時,發送給自己的訊息
setTimeout(function(){
    var userId = 'U087e7ce49XXXX240e6d8108';
    var sendMsg = 'server啟動惹';
    bot.push(userId,sendMsg);
    console.log('send: '+sendMsg);
},5000);


//製作回覆
bot.on('message', function (event) {

switch(event.message.type){

	case 'text':
	
		switch(event.message.text){

		
		//隨機圖片
		case '圖片':

		var rp = require('request-promise');
		exports.reply = function justReply(req, res) {
		
			const promises = req.body.events.map(event => {
		
				var msg = event.message.text;
				var reply_token = event.replyToken;
		
		
				var imgur_options = {
					method: 'GET',
					uri: "https://api.imgur.com/3/album/W3XXXs0/images",
					headers: {
					  "Authorization": "Client-ID 81937XXXXXbb15b"
					},
					json: true
				};
		
		
				return rp(imgur_options)
				.then(function (imgur_response) {
		
					// collect image urls from the album
					var array_images = [];
					imgur_response.data.forEach(function(item){
						array_images.push(item.link);
					})
		
					// choose one of images randomly
					var target_imageUrl = array_images[Math.floor(Math.random()*array_images.length)];
		
					var lineReply_options = {
						method: 'POST',
						uri: "https://api.line.me/v2/bot/message/reply",
						headers: {
						  "Content-type": "application/json; charset=UTF-8",
						  "Authorization": "Bearer eFFUlF0tlo5m1BpBQHqJW2FjWiHPPzZIDup23ka0UyElLuTdtiVD/y95YyrrrBjOtzsXXXXXXXCuobPKPO6Xi4CvZh2+vaGOl1XKRRomy/yulQYdjdIXXXXXXXXXXXXXBi3JM74wdB04t89/1O/w1cDnyilFU="
						},
						json: true,
						body: {
						  replyToken: reply_token,
						  messages:[
							{
								type: 'image',
								originalContentUrl: target_imageUrl.replace("http", "https"),
								previewImageUrl: target_imageUrl.replace("http", "https")
							}
						  ]
						}
					};
		
					return rp(lineReply_options);
		
				})
				.catch(function (err) {
					console.log( err );
				});
		
			});
		
			Promise
			.all(promises)
			.then(() => res.json({success: true}));
		
		
		};

			break;

		}
	break;

	
}

});




app.listen(process.env.PORT || 80, function () {
	console.log('LineBot is running.');
});

Online AngularJS Editor

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>
    <div>
      <label>Name:</label>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">
      <hr>
      <h1>Hello {{yourName}}!</h1>
    </div>
  </body>
</html>

third appln demo

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>
    <div ng-app="">
        <table border="0">
            <tr>
                <td><input type="checkbox" ng-model="enableDisableButton">Disable Button</td>
                <td><button ng-disabled="enableDisableButton">Click me</button></td>
            </tr>
            
            <tr>
                
                <td><input type="checkbox" ng-model="showHide">ShowHide</td>
                <td><button ng-show="showHide">Click me</button></td>
            </tr>
            <tr>
                <td><p>Total Click : {{ Clickcounter }}</p></td>
                <td><button ng-click = "Clickcounter = Clickcounter + 1">Click ME !</button></td>
                
            </tr>
        </table>
        
   </div>
  </body>
</html>

Online AngularJS Editor

<!doctype html>
<html ng-app="myApp">
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>
    <div ng-controller="myCtrl">
      first name:  <input type="text" ng-model="firstname"><br>
     last name:   <input type="text" ng-model="lastname"><br>
     
     full name: {{firstname+" "+lastname}}
        
    </div>
    <script>
    var app=angular.module("myApp",[]);
    app.controller("myCtrl",function($scope){
    $scope.firstname="john";
    $scope.lastname="lee";
    });

    
    
     </script>      
    
  </body>
</html>

Online AngularJS Editor

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>

  <div ng-app>

   10+20 = {{10 + 20}}

 </div>

<div>
   40+50 = {{40 + 50}}
</div>

</body>
</html>

when Binding not required

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>

  </head>
  <body>
      <div ng-non-bindable>
          Just i wanted to print &lcub;&lcub;2+1&rcub;&rcub; in angularjs application
      </div>
    <br />
    <div>
      Without ng-non-bindable : 
      <p id="d1"></p>
      With ng-non-bindable : 
      <p id="d2" ng-non-bindable></p>
    </div>
    
    <script>
       
        $("#d1,#d2").html("{{2+1}}");
        
    </script>
    
  </body>
</html>

Online AngularJS Editor

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>
    <div>
      <label>Name:</label>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">
      <hr>
      <h1>Hello {{yourName}}!</h1>
    </div>
  </body>
</html>

Online AngularJS Editor

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
    <!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

  </head>
  <body>
    <div>
      <label>Name:</label>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">
      <hr>
      <h1>Hello {{yourName}}!</h1>
    </div>
    <div class="alert alert-danger" role="alert">
  <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
  <span class="sr-only">Error:</span>
  Enter a valid email address
</div>
  </body>
</html>

Online AngularJS Editor

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>
    <div>
      <label>Name:</label>
      <input type="text" ng-model="yourName" placeholder="Enter a name here">
      <hr>
      <h1>Hello {{yourName}}!</h1>
    </div>
  </body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.