Many a times, I wanted to experiment with AngularJS features on an HTML form. This required me to re-write or copy & paste angularjs code and bootstrap form code and create a simplistic form to get started. This is where this idea of creating a quick Sublime snippet which could be used to quickly create a simplistic or I would say, kickstarter AngularJS-Bootstrap form app. This has ended up enhancing my productivity and I get started on experimenting any Angular feature as quickly as possible. Now, I open a new html file in sublime, and write ngform (name of snippet as shown in below code sample) and do CTRL + spacebar. That is it. I get an Angular App with simplistic bootstrap form.
Following is how you could create and save the snippet:
<snippet>
<content><![CDATA[
<html>
<head>
<title>AngularJS - Form Template</title>
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
</head>
<body class="container" ng-app="HelloApp" ng-controller="HelloCtrl">
<h1>Hello, {{name}}</h1>
<hr/>
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="name" class="col-sm-2 control-label">Name</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="name" ng-model="name" placeholder="Name">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</form>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.min.js"></script>
<script type="text/javascript">
angular.module('HelloApp', [])
.controller('HelloCtrl', ['\$scope', function(\$scope){
\$scope.name = "Calvin";
}])
</script>
</body>
</html>
]]></content>
<tabTrigger>ngform</tabTrigger>
<scope>text.html</scope>
</snippet>
In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…
Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…
With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…
Anxiety is a common mental health condition that affects millions of people around the world.…
In machine learning, confounder features or variables can significantly affect the accuracy and validity of…
Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…