Could you help me write a new snippet?
gkatsanos opened this issue · 2 comments
gkatsanos commented
I am using ui-router and I'd like to write a snippet for it's config syntax.. https://github.com/angular-ui/ui-router
myApp.config(function($stateProvider) {
$stateProvider
.state('index', {
url: "",
views: {
"viewA": { template: "index.viewA" },
"viewB": { template: "index.viewB" }
}
})
.state('route1', {
url: "/route1",
views: {
"viewA": { template: "route1.viewA" },
"viewB": { template: "route1.viewB" }
}
})
.state('route2', {
url: "/route2",
views: {
"viewA": { template: "route2.viewA" },
"viewB": { template: "route2.viewB" }
}
})
});subhaze commented
It looks like you might want to have two snippets and you can save these in your Packages/User folder as some-name.sublime-snippet.
Below are some examples:
This is triggered via ui-config-state
<snippet>
<content><![CDATA[
config(function(\$stateProvider) {
\$stateProvider
.state('$1', {
url: "$2",
views: {
"$3": { template: "$1.$3" },
"$4": { template: "$1.$4" }
}
})$5
});
]]></content>
<tabTrigger>ui-config-state</tabTrigger>
<scope>source.js</scope>
<description>Angular.js ui-router config</description>
</snippet>This is triggered via ui-state
<snippet>
<content><![CDATA[
.state('$1', {
url: "$2",
views: {
"$3": { template: "$1.$3" },
"$4": { template: "$1.$4" }
}
})$5
]]></content>
<tabTrigger>ui-state</tabTrigger>
<scope>source.js</scope>
<description>Angular.js ui-router state</description>
</snippet>gkatsanos commented
That's awesome, I was trying to make an "autocomplete" instead...
Thanks a million.