Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

a-template

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a-template

Simple Template Engine

  • 0.0.19
  • npm
  • Socket score

Version published
Weekly downloads
425
decreased by-55.07%
Maintainers
1
Weekly downloads
 
Created
Source

#a-template.js

Simple Template Engine used for gulp-generator

##example

<!DOCTYPE html>
<html lang="ja">
<head>
	<meta charset="UTF-8">
	<title>list sample</title>
</head>
<body>
	<script id="list_template" type="text/template">
	<ul>
		<li><input type="text" data-bind="newItem"><button data-action="addItem()">追加</button></li>
		<!-- BEGIN list:loop -->
		<li>{name}[addMr]<button data-action="removeItem({i})">削除</button></li>
		<!-- END list:loop -->
	</ul>
	</script>
	<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
	<script src="../aTemplate.js"></script>
	<script>
	var list = new aTemplate.View({
		templates:["list_template"],
		data:{
			list:[
				{name:"tomomi"},
				{name:"daigo"},
				{name:"taro"},
				{name:"koike"}
			]
		},
		method:{
			removeItem:function(i){
				this.data.list.splice(i,1);
				this.update();
			},
			addItem:function(){
				console.log(this.data.newItem);
				this.data.list.push({name:this.data.newItem});
				this.update();
			}
		},
		convert:{
			addMr:function($txt){
				return "Mr."+$txt;
			}
		}
	});
	list.update();
	</script>
</body>
</html>

FAQs

Package last updated on 20 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc