Wrap Angular App in a jQuery function

peta

I am writing an AngularJS App for a system based on jQuery. Each app needs to be initiated with the code below.

How do I get this to work with my AngularJS code?

I have tried to include my entire Angular app within the function appStart(), but that doesn't work. Any ideas on how to solve this?

Init JS:

(function () {
    function appStart() {
}

function genericError() {
    console.error('Something went wrong');
}

TT.native.init()
.done(appStart)
.fail(genericError);
})();

My AngularJS app:

var app = angular.module('myApp', ['ui.sortable', 'ui.router']);

app.config(function ($stateProvider, $urlRouterProvider) {

    $urlRouterProvider.otherwise('/specs');

    $stateProvider
    .state('specs', {
        url: '/specs',
        templateUrl: 'specs.html',
        controller: 'SpecsController'
    })
    .state('editSp...
Lowe Bäckström

Long time since I used it but this should work. It's a manual bootstrap of Angular so no ng-app in your index file.

(function () {
    $(document).ready(function () {
        if (TT) {
            TT.native.init().done(function () {
                angular.bootstrap(document, ['myTickTailApp']);
            }).fail(function () {
                // Error handling if TickTail fails to init ...
            });
        } else {
            throw new Error('Cannot start app, tt.js not loaded');
        }
    });
})();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why do we wrap Angular app inside a function?

From Dev

Wrap JQuery in Angular directive

From Dev

Wrap JQuery in Angular directive

From Dev

How to wrap the jQuery function

From Dev

Wrap jQuery plugin with a function

From Dev

Is there a way to wrap a jquery function to an object?

From Dev

Wrap function Jquery for multiple elements

From Dev

How to wrap a jQuery control as an angular directive?

From Dev

Using Jquery wrap function with absolute placed element

From Dev

jQuery wrap() in on()

From Dev

Why wrap your angular controller code with anonymous function?

From Dev

wrap set time out function around simple slide animation jquery

From Dev

How important it is to wrap jquery code in $(document).ready() function?

From Dev

Wrap the function into another function

From Dev

Call jQuery function by Angular view

From Dev

jquery.submit function with angular

From Dev

scope of "this" in async function of ionic angular app

From Dev

Angular + RequireJS app gives error "mainController not a function"

From Dev

How to bind graphicsmetrics jquery plugin in Angular app

From Dev

How to Invoke Jquery plugins in angular js app

From Dev

Angular application notify surrounding JQuery app of an event

From Dev

Wrap/overwrite function in Bash

From Dev

Wrap delegate in std::function?

From Dev

Wrap a function as an async task

From Dev

wrap couchbase access function

From Dev

wrap overloading function with generics

From Dev

Wrap R function in python

From Dev

Wrap alloca function in C

From Dev

failed to wrap function with lambda