' into templateUrl \"html\" document ?", "text": "

Hi,

Something we do in CRUD environments is to include Java ro", "answerCount": 5, "upvoteCount": 0, "dateCreated": "undefined", "author": { "@type": "Person", "name": "marcusbo" }, "suggestedAnswer": [ { "@type": "Answer", "text": "

Whoa what is going on here? Would you care to clean up your question? I'm not able to ", "dateCreated": "undefined", "upvoteCount":0, "url": "https://githubhelp.com//angular-ui/ui-router/issues/53#15091340", "author": { "@type": "Person", "name": "timkindberg" } } , { "@type": "Answer", "text": "

Hi Tim,

It looks like I did a copy/paste of some code and this showe", "dateCreated": "undefined", "upvoteCount":0, "url": "https://githubhelp.com//angular-ui/ui-router/issues/53#15102214", "author": { "@type": "Person", "name": "marcusbo" } } , { "@type": "Answer", "text": "

This does not sound like a good idea to me, kind of the opposite of accepted best prac", "dateCreated": "undefined", "upvoteCount":0, "url": "https://githubhelp.com//angular-ui/ui-router/issues/53#15161623", "author": { "@type": "Person", "name": "ksperling" } } , { "@type": "Answer", "text": "

Hi Karsten,

I'm surprised you closed this discussion and wrote the w", "dateCreated": "undefined", "upvoteCount":0, "url": "https://githubhelp.com//angular-ui/ui-router/issues/53#15167540", "author": { "@type": "Person", "name": "marcusbo" } } , { "@type": "Answer", "text": "

GithubHelp home page GithubHelp logo

Comments (5)

timkindberg avatar timkindberg commented on August 24, 2024

Whoa what is going on here? Would you care to clean up your question? I'm not able to follow.

from ui-router.

marcusbo avatar marcusbo commented on August 24, 2024

Hi Tim,

It looks like I did a copy/paste of some code and this showed up as HTML-speak...

I would like to see that a "templateUrl" can load any "myXxx.html" (partial) file, in which we can have as many times:

<script src="path/MyJavaScriptFile.js">< /script>

or:

<script type="text/javascript">
       SOME JAVASCRIPT CODE HERE
< /script> 

...with embedded controllers and other JavaScript code that run when the "myXxx.html" is loaded.

In other words, the classical ui-router would just need:

$stateProvider
   .state( "myState"  ,  {
         views : {
              "myView" : {
                  templateUrl  :  "myXxx.html",
                  BUT, NO NEED TO STATE THE CONTROLLER HERE, 
                  BECAUSE THE JS CODE IS EMBEDDED IN 'myXxx.html'
               }
           },

Another really "cool" alternative would be to allow us to insert a JS file in the views:

 templateUrl  :  "myXxx.html",
 controllerUrl  :  "myXxx.js"

Thanks,

Marcus

from ui-router.

ksperling avatar ksperling commented on August 24, 2024

This does not sound like a good idea to me, kind of the opposite of accepted best practice of separation of concerns etc.

Mind you, you should be able to have script tags in templates, and the code should run at some point after the template is inserted into the DOM, but you won't have any control over when exactly, nor will $state be able to pick up particular constructs like controller functions in the code and somehow magically attach them to the correct states.

If you want to have different developers working on different parts of the app, just split it up into modules that have their own sets of JS files and templates, but bring the JS together via concat/minify at build time.

from ui-router.

marcusbo avatar marcusbo commented on August 24, 2024

Hi Karsten,

I'm surprised you closed this discussion and wrote the whole thing off as a bad idea. No point in arguing with you on this one, as I don't have the experience or appetite for this.

We are going to find another way, without ui-router, since you don't think its a valid request.

Perhaps the next versions of AngularJS will have something more suitable for multi-view solutions. iu-router doesn't have what it takes here.

Marcus

from ui-router.

ksperling avatar ksperling commented on August 24, 2024

@marcusbo I've given you multiple reasons why script tags in templates are a bad idea, and they have nothing to do with ui-router -- core Angular $route / ng-view work in the same way.

If you've got anything constructive to add, feel free to reopen the ticket or submit a pull request. If you think sulky remarks are the right way to get people to do work for you for free you've got a thing or two to learn yet about open source projects (and people in general).

from ui-router.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.