Questions tagged [canjs]

CanJS is an MVC/MVVM library for JavaScript with modern features like live-binding and computed values.

CanJS is an open source JavaScript MVC framework for professional JavaScript developers who need advanced capabilities in an easy-to-use package.

CanJS emphasizes writing quality code that results in maintainable, fast applications. It includes templates with two-way binding, observables that connect to a RESTful JSON interface, and routing/deep linking support.

Links

Asking a question

  • Link to documentation where possible
  • Reduce the problem to the smallest working example
  • Create a JSFiddle or clone this basic one to show functional code

Answering a question

  • If documentation exists on CanJS.com, link to it
  • If documentation does not answer the question, open a new CanJS issue with the Documentation label and link to the question
  • If the question identifies a bug:

CanJS is primarily developed by Bitovi for use in real-world projects.

226 questions
10
votes
2 answers

How to Debug EJS code in Chrome/Safari

I am using EJS templates with CanJS and are looking for a way to debug my EJS code. Currently firebug can show me the syntax errors in EJS but in other browsers, I am not able to see anything.I need to go through my EJS file very carefully to solve…
Ankur Aggarwal
  • 2,993
  • 5
  • 30
  • 56
9
votes
1 answer

can-model cannot getting data from .json file

I am trying to implement MVC using AMD in canjs. For that I am using requirejs. This is my domains.json file: [ "1":{"uid": "1","urls": "domain1.abc.com"}, "2":{"uid": "2","urls": "domain2.abc.com"}, "3":{"uid": "3","urls":…
Dipesh Raichana
  • 1,008
  • 3
  • 18
  • 36
6
votes
2 answers

how to animate canjs templates

Can anyone explain How to animate mustache templates? I am following the documentation from canjs animation I have downloaded animate from here. I have added to my app.js file. So how can I load that file in application? I have written this code in…
Dipesh Raichana
  • 1,008
  • 3
  • 18
  • 36
6
votes
1 answer

function(el,ev) what does it mean?

when i have something like this ".mylabel click": function (el,ev){ //mycode in here } what does el mean? what does ev mean? I have tried searching it in canjs, but there isn't enough information.
mess
  • 63
  • 1
  • 1
  • 3
5
votes
1 answer

autosuggestion is not working using canjs

I am trying to to create auto suggest element manually. I am using canjs for this prupose. Following code I have tried so far: list.filter( function( item, index, list ) { if(item.includes(searchText) && searchText != ''){ //css hide and…
Dipesh Raichana
  • 1,008
  • 3
  • 18
  • 36
4
votes
1 answer

CanJS - Control Communication

I am learning CanJS now , so I want to try a very basic small demo. The demo is you will have different types of mobile recharge plans which displayed on the top (Radio buttons) and by choosing each plan the corresponding price options will be…
Sabha B
  • 2,079
  • 3
  • 28
  • 40
4
votes
1 answer

CanJS Model findAll returns list of duplicate items

I'm using can.Model to retrieve data by id: Invoice = can.Model({ findAll: 'GET /invoices', create : "POST /invoices", update : "PUT /invoices/{id}", destroy : "DELETE /invoices/{id}" },{}); When navigating to /invoices, the…
Anton Gildebrand
  • 3,641
  • 12
  • 50
  • 86
3
votes
0 answers

javascript sorting a map based on it's attribute and return map

I am trying to sort a map which is inside a filter and return the map var sort = this.attr('component').attr('sort'); if (sort == 'Price Descending') { return this.attr('%root.products').filter(function(product) { // How can I…
Cowgirl
  • 1,454
  • 5
  • 19
  • 40
3
votes
1 answer

How to get component reference inside of the model save callback functions?

I have a login component with a model that goes to the server and receives an error if the login was no correct. Here is the idea of what I'm talking about: var LoginModel = can.Model.extend({ create : "POST…
Flavio Garcia
  • 1,491
  • 1
  • 14
  • 20
3
votes
2 answers

Location.hash returns empty string

I am currently using jQuery, Twitter Bootstrap and CanJS for my web application. I'm trying to implement routing with CanJS. I'm using Bootstrap's tab, and when I click on a tab, it was supposed to bring #tabSearch, #tabUser or #tabPermissions, but…
Glund
  • 507
  • 1
  • 5
  • 20
3
votes
1 answer

CanJS object list automatic subclassing and reclassing

A remote, third-party JSONP server provides my CanJS script with a list of results like this one: [ { "class": "ABaseClass", "value": "1"}, { "class": "ASubClass", "value": "2"}, { "class": "ABaseClass", "value": "3"}, { "class":…
Brian
  • 7,394
  • 3
  • 25
  • 46
3
votes
1 answer

More restfunctions on canjs model

Is there a way to add more rest bindings on model then just the four CRUD functions? var Customer = can.Model({ findAll: 'GET /customer', findOne: 'GET /customer/{id}', create: 'POST /customer', update: 'PUT /customer/{id}', …
3
votes
1 answer

Defining two separate routers with can.Control.route in CanJS

I have two routes defined in different JS-documents, although both are included into the same HTML-file. Route 1 looks like this: Router = can.Control({ "invoices/:id route": function(data){ //load an invoice by id } }); And the other…
Anton Gildebrand
  • 3,641
  • 12
  • 50
  • 86
2
votes
0 answers

CANJS Routing Issue

In my Router code, I have the following routes: Router = can.Control ( { "adminPrograms route" : function ( ) { // Load Programs screen... } , "adminProgramSkus route" : function ( ) { // Load Program Skus…
Griz
  • 21
  • 1
2
votes
2 answers

CanJS on click outside of component effecting component

I would like to add an event listener in in that reacts to the button. I am sure this is really simple. I am very new to CanJS and working on…
1
2 3
15 16