Skip to content

Instantly share code, notes, and snippets.

angular.module('formComponents', [])
.directive('formInput', function() {
return {
restrict: 'E',
scope: {},
link: function(scope, element, attrs)
{
var type = attrs.type || 'text';
var required = attrs.hasOwnProperty('required') ? "required='required'" : "";
var htmlText = '<div class="control-group">' +
/*
*usage: <textarea ui:pagedown-bootstrap ng:model="box.content"></textarea>
*/
myApp.directive('uiPagedownBootstrap', function($compile) {
var nextId = 0;
//Make converter only once to save a bit of load each time
var markdownConverter = new Markdown.Converter();
return {
require: 'ngModel',
replace:true,
@ajoslin
ajoslin / gist:3181630
Created July 26, 2012 11:52
bootstrap tabs in plain angular
<!-- Tab links at top, always visible with one 'active' -->
<ul class="nav nav-tabs">
<li ng-repeat="tab in tabs" ng-class="{active: selectedTab == tab}" ng-click="selectedTab = tab">
<a ng-href="#{{tab.id}}">{{tab.title}}</a>
</li>
</ul>
<!-- Tab contents, only one ever visible -->
<div class="tab-content">
<div ng-repeat="tab in tabs" class="tab-pane" ng-class="selectedTab == tab && 'active' || 'hide'" id="{{tab.id}}">
@ajoslin
ajoslin / gist:3307372
Created August 9, 2012 19:34
Worklight + ChildBrowser LinkedIn Authentication
//Code Snippet from blog post: OAuth with Worklight & Cordova ChildBrowser Plugin, http://wp.me/p2lwuh-2j
//Helper function. turn #a=b&b=c to {a:'b', b: 'c'}
var parametersFromUrl = function(url) {
var result = {};
//Remove everything up to where the parameters start. could be after # or after ?
url = url.substr(url.indexOf('?') + 1).substr(url.indexOf('#') + 1)
//Replace html escape characters
url = url.replace(/%23/g, '#').replace(/%26/g, '&').replace(/%3D/g, '=');
@ajoslin
ajoslin / gist:3308288
Created August 9, 2012 21:42
Worklight + ChildBrowser LinkedIn Authentication
//Code Snippet from blog post: OAuth with Worklight & Cordova ChildBrowser Plugin, http://wp.me/p2lwuh-2j
//Helper function. turn #a=b&b=c to {a:'b', b: 'c'}
var parametersFromUrl = function(url) {
var result = {};
//Remove everything up to where the parameters start. could be after # or after ?
url = url.substr(url.indexOf('?') + 1).substr(url.indexOf('#') + 1)
//Replace html escape characters
url = url.replace(/%23/g, '#').replace(/%26/g, '&').replace(/%3D/g, '=');
@ajoslin
ajoslin / angular-ui-repo_grunt.js
Created October 6, 2012 16:02
Example grunt layout
module.exports = require('grunt-repo/grunt');
/* An AngularJS directive to easily paginate any list of items */
/*
* The directive exposes a $pager (or other name set by ng-model) object to the view, with these properties
* $pager.items : array of current page's items
* $pager.index : current page index
* $pager.first : boolean, current page is first?
* $pager.last : boolean, current page is last?
* $pager.group : array of numbers representing current page group (eg [1,2,3,4,5])
* $pager.groupIndex : current group index
// The `$dialogProvider` can be used to configure global defaults for your
// `$dialog` service.
var dialogModule = angular.module('ui.bootstrap.dialog', ['ui.bootstrap.transition']);
dialogModule.controller('MessageBoxController', ['$scope', 'dialog', 'model', function($scope, dialog, model){
$scope.title = model.title;
$scope.message = model.message;
$scope.buttons = model.buttons;
$scope.close = function(res){
dialog.close(res);
@ajoslin
ajoslin / problems.md
Last active December 16, 2015 18:29
ui-bootstrap $dialog service refactor discussion

(written by @pawel)

We've got a number of bug reports opened for the $dialog service and while some of them can be fixed by (relatively) simple changes to the existing code-base some other are difficult to solve due to the way current code is structured. Additionally the existing API would benefit from some some simplifications.

This docs aims to list existing issues and propose a new API plus some implementations details that would address existing issues.

As a remainder, docs for the current service are located here: https://github.com/angular-ui/bootstrap/blob/master/src/dialog/README.md

Known issues

API

@ajoslin
ajoslin / errorlog
Created August 2, 2013 05:00
jitsu err
Error: Cannot find module 'firebase'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/opt/haibu/apps/appriculture/appriculture-server/package/lib/apprifire/index.js:2:16)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)