Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Created September 9, 2013 21:19
Show Gist options
  • Select an option

  • Save clouddueling/6501676 to your computer and use it in GitHub Desktop.

Select an option

Save clouddueling/6501676 to your computer and use it in GitHub Desktop.
Temporarily isolate a small jquery app in angularjs?

How can I run an isolated large jquery script inside of an AngularJS app?

It is completely self contained and loads via ajax requests.

I'm the only developer at this time and temporarily until I can completely finish our conversion from jQuery I have a large jquery "app" (more like script) than must be working in the meantime.

Using AngularJS 1.0.7 It's 1023 lines

var s,
FormEditor = {
  settings: {
		cardId: $('[data-card-id]').data('card-id'),
		currentGroupId: 0,
		formNameInput: $('.form-name'),
		formDescriptionInput: $('.form-description'),
		formInputs: $('.builder-form-settings input, .builder-field-settings input, .builder-form-settings textarea, .builder-field-settings textarea'),
		groups: '',
		groupPreview: $('.group-preview'),
		trackers: '',
		move: true,
		topPadding: 5,
		maps: new Array(),
		move: true,
		unsavedData: false,
		finishLocation: ''
	},
    
    // lots of disgusting callback methods

    return {
        init: init
    }
})(this, document);

FormEditor.init({
	cardId: $('[data-card-id]').data('card-id'),
}); 

Kind of like a bad version of this: https://gist.github.com/clouddueling/6501638

Can I put all of this inside the link function of a directive?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment